Syntax error - variable not found

Ben_Entrew

Registered User.
Local time
Today, 13:33
Joined
Dec 3, 2013
Messages
177
Dear all,

somehow it doesn't take this variable msoFileDialogSaveAs. It tells me it's unknown.

Does someone has an idea what is missing?

Thanks in advance.

Regards,
Ben

Code:
Public Sub Command2_Click()

On Error GoTo MyError3
Dim filelocation As Variant
Dim g As Object


Set g = Application.FileDialog(msoFileDialogSaveAs)
  
    With g
        .allowmultiselect = False
        .Title = "Select Export Location"
        If .Show <> -1 Then Exit Sub
    End With


filelocation = g.SelectedItems(1)

Exit Sub

MyError3:
MsgBox Err.Number & ": " & Err.Description



End Sub
 
You don't have a reference to the "Microsoft Office 14 object library" (14 for office 2010).
 
Or simply use 2 instead of msoFileDialogSaveAs ;)
 

Users who are viewing this thread

Back
Top Bottom