I developed an Outlook macro that lets the user choose and open an Excel file.
The file dialog box opens in the background. To the user it looks like the Outlook application is stuck whereas its just waiting for the user to choose a file in the Filepicker dialog box behind all other windows.
Dim SigFolder2 As String
Dim fd As Office.FileDialog
Dim selectedItem As Variant
Dim ExcelFileName As String
Dim FileName As String
Dim objExcel As New Excel.Application
Dim exWb As Excel.Workbook
'Suggested Folder--Downloads
SigFolder2 = "C:\Users\" & Environ("UserName") & "\Downloads\"
'Dialog Settings
Set fd = objExcel.FileDialog(msoFileDialogFilePicker)
With fd
.Filters.Clear
.InitialFileName = SigFolder2
.AllowMultiSelect = False
.Title = "Select Signature File"
End With
'Getting the file
If fd.Show = -1 Then
For Each selectedItem In fd.SelectedItems
SigFolder = selectedItem
Next
Else
Exit Sub
End If
ExcelFileName = SigFolder
FileName = Left(fso.GetFileName(ExcelFileName), InStr(fso.GetFileName(ExcelFileName), ".") - 1)
Debug.Print ExcelFileName 'file Path with filename
Is there any way to correct this?