Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
The below code gives me a compiling error. "Compile error: Wrong number of arguments or invalid property assignment" The error seems to occur on the .Filters.Add
The .Add is highlighted in blue if that helps.
How can I center the title text on a userform.
Thank You
The .Add is highlighted in blue if that helps.
How can I center the title text on a userform.
Code:
Private Sub cmdBrowse_Click()
'myFile = Application.GetOpenFilename(, , "Select a File.")
Dim fname As String
Dim fpath As String
fpath = ThisWorkbook.Path
With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = fpath
.ButtonName = "Get File Name"
.Title = "File Selection"
.Filters.Clear
.Filters.Add "*.xl", "*.xlsx", "*.xlsm", "*.xlb", "*.xlam", "*.xltx", "*.xltm", "*.xls", "*.xla", "*.xlt", "*.xlm", "*.xlw"
.AllowMultiSelect = False
If .Show = True Then
fname = .SelectedItems(1)
Me.TextBox1.Text = fname
Else
MsgBox "Operation Canceled"
End If
End With
End Sub
Last edited: