Hi guys,
I have a macro that prompts the user to select a path:
Macro no.1
Macro no.1 then calls another Macro no.2 that creates a number of emails and SHOULD store any attachments in the strFolderpath:
Since the path is the same for all the emails, I don't want the folder picker prompt to appear each time. However, I cannot think of a way to pass the path to macro no. 2
Thank you in advance for any suggestion.
I have a macro that prompts the user to select a path:
Macro no.1
VBA Code:
With Excel.Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = "U:\MyPath\"
If .Show = -1 Then ' if OK is pressed
strFolderpath = .SelectedItems(1)
End If
End With
Macro no.1 then calls another Macro no.2 that creates a number of emails and SHOULD store any attachments in the strFolderpath:
Code:
If strFolderpath <> "" Then ' if a file was chosen
'
' ' Combine with the path to the Temp folder.
strFile = strFolderpath
' Save the attachment as a file.
oAttachments.Item(i).SaveAsFile strFile
End If
Since the path is the same for all the emails, I don't want the folder picker prompt to appear each time. However, I cannot think of a way to pass the path to macro no. 2
Thank you in advance for any suggestion.