Results 1 to 1 of 1

UserForm, ListBox, FilePath, Import and Export HELP!

Threaded View

duncanm82 UserForm, ListBox, FilePath,... 08-25-2012, 01:18 AM
  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    Tauranga, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    6

    Exclamation UserForm, ListBox, FilePath, Import and Export HELP!

    ImportProcessExport.xlsmDataset.zip

    I have created a UserForm which has (top to bottom):
    1. Button labelled "Select Dataset to Import"
    2. ListBox
    3. Button labelled "Import Dataset"
    4. 3 ListBox for XYZ coordinates
    5. Button labelled "Process Dataset"
    6. Button labelled "Export Dataset As (*.CSV)"
    7. ListBox
    8. Button labelled "Export Dataset"
    9. 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.
    Last edited by duncanm82; 08-25-2012 at 02:00 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1