ImportProcessExport.xlsmDataset.zip
I have created a UserForm which has (top to bottom):- Button labelled "Select Dataset to Import"
- ListBox
- Button labelled "Import Dataset"
- 3 ListBox for XYZ coordinates
- Button labelled "Process Dataset"
- Button labelled "Export Dataset As (*.CSV)"
- ListBox
- Button labelled "Export Dataset"
- Button labelled "Close"
1/ I would like the "Select Dataset to Import" button to open a windows pop-up that lets me navigate to a specific file. The filepath should default to "C:\TEMP" and should only allow datasets with the extension (*.NPD).
I have managed to code something that opens the pop-up box in the chosen directory. See below:
Private Sub SelectDataset_Click()
Dim fd As FileDialog
Dim FileName As String
Set fd = Application.FileDialog(msoFileDialogOpen)
Dim FileChosen As Integer
FileChosen = fd.Show
fd.Title = "Open Your Dataset"
fd.InitialFileName = "C:\TEMP"
fd.Filters.Clear
fd.Filters.Add "NaviPac", "*.NPD"
fd.FilterIndex = 1
fd.ButtonName = "Import Dataset"
If FileChosen <> -1 Then
MsgBox "Closing"
Else
FileName = fd.SelectedItems(1)
End If
End Sub
2/ I would like the chosen dataset (or filepath/dataset to be viewable in the first ListBox
3/ I would like to then load this Dataset (which is a CSV file) in to a worksheet for "Processing" in the background. The File will be simply: Time,Heading,Roll,Pitch,Heave.
4/ I'd like the user to be able to enter values in to these 3 Text Boxes. (XYZ coordinates). This would also be blank on opening the UserForm each time.
5/ This button would then "Process" the dataset which would have been temporarily loaded in to a seperate worksheet (From Step 3). This process would input the formula (call it) F2=C2+D2+E2 and makes all rows have this formula (F3=C3+D3+E3 etc all the way to the end of the rows)
6/ This button would open another pop-up which the user could then specify a filepath and file name. The selected filepath/filename would display in the following ListBox.
7/ Contain the Save As filepath/filename.
8/ This would Save the "Processed" worksheet as a filename.CSV file and then delete the temporary worksheet that was used for processing the dataset.
9/ This closes the UserForm. I have coded this part as well:
Private Sub CloseCancel_Click()
Unload Me
End Sub
EDIT: Formula should include the XYZ enter coordinates. Lets say F2=C2+D2+E2+X+Y+Z. I know the formula doesn't make sense. I'll sort that out once I learn how to link to the XYZ entered numbers.
Much thanks for anyone who can supply any information at all.
Bookmarks