M
mrsadmin
Hi there,
I am currently working on sending sales reports with a little bit more 'ease'. I have the following code set in Outlook, I am able to get 2 files, I am however wanting to get a 3rd, I don't know the string to get it however.
The problem lies in that the name needs a wildcard (I've added a note in the code).
Secondly, I want to pull some information from Excel cells themselves, month of sales, month of payment, etc. Should I switch my original VBA to excel and push the data, or can I keep it in Outlook and pull in the data?
Adding data from my excel sheet, not attached, only the .pdf is.
If I do add text it also destroys the existing formatting of the .oft that I have. I want to keep the formatting the same.
Many thanks.
I am currently working on sending sales reports with a little bit more 'ease'. I have the following code set in Outlook, I am able to get 2 files, I am however wanting to get a 3rd, I don't know the string to get it however.
The problem lies in that the name needs a wildcard (I've added a note in the code).
Secondly, I want to pull some information from Excel cells themselves, month of sales, month of payment, etc. Should I switch my original VBA to excel and push the data, or can I keep it in Outlook and pull in the data?
Code:
Sub zzzAccsReceipt()
'source: SlipSticK: http://bit.ly/1jzoTy7 (Template Button)
'source: mrexcel: http://bit.ly/1dlG0Qr (attach with 'Date')
'.Attachments.Add "G:\Financial Planning\" & Format(PrevDay, "yyyy") & " Daily Sales\Production\" & Format(PrevDay, "mmmm") & "\Daily Sales " & Format(PrevDay, "mmmm yyyy") & " by Channel_" & Format(PrevDay, "mmddyy") & ".pdf"
'source: http://bit.ly/1magjbd (strLocation)
Dim newItem As Outlook.MailItem
Dim dateFormat As String
dateFormat = Format(Now, "YYYYMMDD")
Set newItem = CreateItemFromTemplate("\location\zzz accs.oft")
'strLocation & the following "new items" work without any issues at all. I can use either the strLocation OR just the location itseld
strLocation = "location\zzz fees_" & Format(Now, "YYYYMMDD") & ".pdf"
newItem.Attachments.Add (strLocation)
newItem.Attachments.Add "E:\My Documents\" & "ehs fees_" & Format(Now, "YYYYMMDD") & ".pdf"
newItem.Attachments.Add "E:\My Documents\ehs fees.pdf"
[B]'This is where my issue is: I want to be able to attach a file with a wildcard, I saved the accs files last week but only emailing them now, so how do I wildcard them?[/B]
'Tried:
'newItem.Attachments.Add "\My Documents\" & "zzz fees_" & "*"".pdf"
'newItem.Attachments.Add "E:\My Documents\" & "zzz fees_" & """********.pdf"
newItem.Display
End Sub
Adding data from my excel sheet, not attached, only the .pdf is.
Code:
Sub EHSAccsReceipt()
'source: SlipSticK: http://bit.ly/1jzoTy7 (Template Button)
'source: mrexcel: http://bit.ly/1dlG0Qr (attach with 'Date')
'.Attachments.Add "G:\Financial Planning\" & Format(PrevDay, "yyyy") & " Daily Sales\Production\" & Format(PrevDay, "mmmm") & "\Daily Sales " & Format(PrevDay, "mmmm yyyy") & " by Channel_" & Format(PrevDay, "mmddyy") & ".pdf"
'source: http://bit.ly/1magjbd (strLocation)
Dim newItem As Outlook.MailItem
Dim dateFormat As String
dateFormat = Format(Now, "YYYYMMDD")
Set newItem = CreateItemFromTemplate("\location\zzz accs.oft")
'strLocation & the following "new items" work without any issues at all. I can use either the strLocation OR just the location itseld
strLocation = "location\zzz fees_" & Format(Now, "YYYYMMDD") & ".pdf"
newItem.Attachments.Add (strLocation)
newItem.Attachments.Add "E:\My Documents\" & "ehs fees_" & Format(Now, "YYYYMMDD") & ".pdf"
newItem.Attachments.Add "E:\My Documents\ehs fees.pdf"
newitem.body [COLOR=#000000][FONT=Consolas]=[/FONT][/COLOR][COLOR=#800000][FONT=Consolas]Item.Body[/FONT][/COLOR][COLOR=#000000][FONT=Consolas]&[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] vbNewLine vbNewLine &
[/FONT][/COLOR][COLOR=#000000][FONT=Consolas] Month of Sales: <location/workbook/sheet/Cell> & vbNewLine
Month of Payment: <location/workbook/sheet/Cell> & vbNewLine
Payment Amount: <location/workbook/sheet/Cell> & vbNewLine
Payment Date: <location/workbook/sheet/Cell> & vbNewLine
[COLOR=#222222][FONT=Verdana]
newItem.Display[/FONT][/COLOR][/FONT][/COLOR]
End Sub
If I do add text it also destroys the existing formatting of the .oft that I have. I want to keep the formatting the same.
Many thanks.