Results 1 to 5 of 5
  1. #1
    degras is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    72

    How to get a load file dialog?

    I get the following error:
    User defined type not defined

    ... on the first line of the following code:
    Dim fDialog As Office.FileDialog
    Dim txtFilePath As String
    txtFilePath = ""
    Set fDialog = Application.FileDialog(msoFileDialogFilePicker)


    With fDialog
    .Title = "Select the file you want to import"
    .AllowMultiSelect = False
    .Filters.Clear
    .Filters.Add "CSV Files", "*.CSV"
    If .Show = -1 Then
    txtFilePath = .InitialFileName
    Else
    Exit Function
    End If
    End With
    FileDialog = txtFilePath

    How do I link to this "Office" library or is there a better way to get a file dialog?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I've always used the API: http://www.mvps.org/access/api/api0001.htm

  3. #3
    degras is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    72
    OK, thanks, I'll give it a try. Just one question: how do I import it into VBA / project? I don't want to paste that much code into my existing VBA file.
    Last edited by degras; 04-12-2011 at 08:50 AM.

  4. #4
    degras is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    72
    Thanks, it works fine.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Do you want to use the Thread Tools and mark this thread as Solved?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Save As Dialog Box for Reports
    By eww in forum Programming
    Replies: 1
    Last Post: 12-01-2010, 03:12 PM
  2. Dialog box form example
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 10:45 PM
  3. Pop-up Dialog Box
    By DianeG in forum Reports
    Replies: 4
    Last Post: 03-29-2010, 09:51 AM
  4. Unwanted Dialog Box
    By ntallman in forum Programming
    Replies: 3
    Last Post: 03-26-2010, 11:11 AM
  5. dialog box errors in report
    By Jane in forum Programming
    Replies: 0
    Last Post: 11-20-2008, 01:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums