Reputation: 3
I'm in the early stages of creating an Excel workbook that will allow you to generate and send Outlook emails based on client data in the workbook using VBA. However, I'm getting a Compile Error for "Invalid Qualifier" in the Sub declaration line.
My problem code (sourced from here):
'Get file path and put it in the proper cell
Sub GetFilePath()
Dim DialogBox As FileDialog
Dim path As String
Set DialogBox = Application.FileDialog(msoFileDialogFilePicker)
DialogBox.Title = "Select quarterly report for " & Range("A" & ActiveCell.Row) & _
" " & Range("B" & ActiveCell.Row)
DialogBox.Filters.Clear
DialogBox.Show
If DialogBox.SelectedItems.Count = 1 Then
path = DialogBox.SelectedItems(1)
End If
Range("D" & ActiveCell.Row) = path
Range("D").Column.AutoFit
End Sub
The basic gist of this is to get it to prompt the user to select a file then to put that file path in a cell so I can use it as an attachment in the Outlook window later.
This ran correctly the first time but will no longer work and throws the "Invalid Qualifier" error on the Sub name line.
Problem line highlighted in debugger
I have tried:
Upvotes: 0
Views: 456