We help IT Professionals succeed at work.
Get Started

Can't get the filedialog buttonname property to work

hallpett
hallpett asked
on
1,647 Views
Last Modified: 2012-05-12
I use the filedialog to select a file and return a filename. See code below.
I expected my use of the the ButtonName property to change the caption on the action button from the default "Open" to "Select", but that don't happen. The code runs without any errors. Is there something I have misunderstood? Appreciate any tips.

Dim fd    As Object
Set fd = Application.FileDialog(3) '3 = filepicker

    With fd
        .Title = "Velg en fil"
        .ButtonName = "Select"
        .AllowMultiSelect = False
        ' Clear out the current filters, and add our own.
        .Filters.Clear
        .Filters.Add "Word dokument", "*.doc"
        .Filters.Add "PDF filer", "*.pdf"
        .Filters.Add "Alle Filer", "*.*"
        .InitialFileName = "D:\Temp\"
        If .Show = True Then
            MsgBox "file choosen = " & f.SelectedItems(1)
        Else
            MsgBox "You clicked Cancel in the file dialog box."
        End If
    End With
 Set fd = Nothing
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2016
Commented:
This problem has been solved!
Unlock 2 Answers and 20 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE