rudogg
New Member
- Joined
- Mar 18, 2022
- Messages
- 28
- Office Version
- 365
- Platform
- Windows
I'm trying to attach a file that is date and timestamped in the file name with this code.
I'm trying to use this code or a form of it to attach the file that was created, since the text before the timestamp stays static.
.AddAttachment Dir("C:\email\" & "Fender_Local_Inventory_" & "*" & ".csv")
Any suggestions would super helpful..
VBA Code:
Dim dt As String, wbNam As String, Destfolder As String
wbNam = "Fender_Local_Inventory_"
dt = Format(CStr(Now), "yyyy-mm-dd-hh-mm-ss")
Destfolder = "C:\email"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs FileName:=Destfolder & "\" & wbNam & dt & ".csv", FileFormat:=xlCSV
ActiveWorkbook.Close SaveChanges:=False
Application.DisplayAlerts = True
Set wkbk = Nothing
MsgBox ("Hey Jerk! Your Fender Local Inventory File Has Been Saved In C:\email")
I'm trying to use this code or a form of it to attach the file that was created, since the text before the timestamp stays static.
.AddAttachment Dir("C:\email\" & "Fender_Local_Inventory_" & "*" & ".csv")
Any suggestions would super helpful..