The details of these can be found on these two posts: Excel VBA form that will save data in a csv file-reusable and Delete entire row for all rows with data in Excel .csv file
This tool is now going to be used by some folks in other states and I have been asked/told to figure out how to install it on their computers without me being there. It was suggested that I either make an "install disk", or a "parameter file". The issues are these:
1. I don't want people to have access to the code and the .csv file path has to be changed whenever the tool (form) is put on a new computer.
2. I usually have to install a date/time picker file for use of the form since Excel doesn't just have it. It's the Microsoft Date and Time Picker Control 6.0 (SP 4) that requires the MSCOMT2.ocx and mscomct2.bat install.
3. I don't know how to make an install disk that will ask for the new file path (only on install) and add it to the code.
4. If an install disk is too tough, I don't know how to make a "parameter file" that someone can put the new path into and have that file read by the code when it runs.
5. I don't know if there is even a way to add the automatic install of the .ocx file and automatic run of the .bat file for the dtp to the code. (I may just have to walk them through this part on the phone or something).
I'm a bit overwhelmed with this. Can anyone help? My code is in the 2 posts mentioned earlier, but here are the places where the file path is required:
Code: Select all
Private Sub cmdDeleteUploadedRecords_Click()
'Delete all data from TestLog.csv
Dim csvWkbk As String
csvWkbk = "C:\Documents and Settings\mydrive\Desktop\LogFiles\TestLog.csv"
If MsgBox("You are about to delete all data from " & csvWkbk & vbCrLf & _
"Are you sure?", vbQuestion + vbYesNo) = vbNo Then
Exit Sub
End If
With Workbooks.Open(Filename:=csvWkbk)
.Sheets("TestLog").Cells.Delete
.Close SaveChanges:=True
End With
End Sub
Code: Select all
Private Sub cmdSubmit_Click()
...
'Open file for appending
f = FreeFile
Open "C:\Documents and Settings\mydrive\Desktop\LogFiles\TestLog.csv" For Append As #f
...
End Sub
Let me know if you want the code in full posted, it's just long.