Granoldad
11-26-2016, 07:11 AM
I have this macro to auto format and save an excel file for time/expense.
Sub SaveMyWorkbook()
' First range A2 is client acroynym.
' Second range B2 is billable.
' Thrid range C2 is consultant name.
' Forth range D2 is week ending.
' Fifth range is file format.
' strFolderPath = F2 "C:\1\"
' Should save as example XYZ-B-for-John Doe-WE-112616.xlsm
Dim strPath As String
Dim strFolderPath As String
strFolderPath = Sheet1.Range("F2").Value
strPath = strFolderPath & _
Sheet1.Range("A2").Value & "-" & _
Sheet1.Range("B2").Value & "-for-" & _
Sheet1.Range("C2").Value & "-WE-" & _
Sheet1.Range("D2").Value & ".xlsm"
ActiveWorkbook.SaveAs Filename:=strPath
End Sub
The file name looks something like this which works great.
XYZ-B-for-John Doe-WE-11-26-16.xlsm
Is there any way I can add to this macro or have another one that will automatically open Outlook and attach the newly saved excel file to a new email message?
I know it is a long shot although it would be even better to auto fill in the To: person?
Sub SaveMyWorkbook()
' First range A2 is client acroynym.
' Second range B2 is billable.
' Thrid range C2 is consultant name.
' Forth range D2 is week ending.
' Fifth range is file format.
' strFolderPath = F2 "C:\1\"
' Should save as example XYZ-B-for-John Doe-WE-112616.xlsm
Dim strPath As String
Dim strFolderPath As String
strFolderPath = Sheet1.Range("F2").Value
strPath = strFolderPath & _
Sheet1.Range("A2").Value & "-" & _
Sheet1.Range("B2").Value & "-for-" & _
Sheet1.Range("C2").Value & "-WE-" & _
Sheet1.Range("D2").Value & ".xlsm"
ActiveWorkbook.SaveAs Filename:=strPath
End Sub
The file name looks something like this which works great.
XYZ-B-for-John Doe-WE-11-26-16.xlsm
Is there any way I can add to this macro or have another one that will automatically open Outlook and attach the newly saved excel file to a new email message?
I know it is a long shot although it would be even better to auto fill in the To: person?