Consulting

Results 1 to 3 of 3

Thread: Solved: VB6 an Excel Filedialog

  1. #1
    VBAX Expert Dave's Avatar
    Joined
    Mar 2005
    Posts
    835
    Location

    Solved: VB6 an Excel Filedialog

    Can't seem to get the right VB6 syntax to open an Excel file dialog. Here's what works in XL VBA...
    [vba]
    With Application.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = False
    .Show
    'get selected file name
    For Each VrtSelectedItem In .SelectedItems
    FLname = VrtSelectedItem
    Next
    End With
    [/vba]
    This doesn't work in VB6 (automation error)...
    [vba]
    Dim ObjExcel As Object
    Set ObjExcel = CreateObject("EXCEL.APPLICATION")
    With ObjExcel.FileDialog(fileDialogType:=msoFileDialogfilepicker)
    .AllowMultiSelect = False
    .Show
    End With
    [/vba]
    Any help will much appreciated. Dave

  2. #2
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    You will need to add a reference to the Microsoft Office 12.0 libary for the msoFileDialogfilepicker

    EDIT: Changed 11.0 to 12.0 Tommy

  3. #3
    VBAX Expert Dave's Avatar
    Joined
    Mar 2005
    Posts
    835
    Location
    Thanks Tommy. That works much better. It is 11.0 for my VB6. Have a nice day. Dave

Posting Permissions

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