Dazzybeeguy
Board Regular
- Joined
- Jan 6, 2022
- Messages
- 72
- Office Version
- 365
- 2010
- Platform
- Windows
I have the following that Works fine, L8 is a cell with Text, however I want it to use Cell W4 which has the formula =Lists!E2&" w/e"&" "&TEXT(O10,"ddd-dd-mmm-yyyy") The formula would return BB w/e Sun-19-Feb-2023
When I try it with W4 as the cell with the value I get Run Time Error '-2147018887 (80071779)': Document Not Saved
Any ideas how I can get the Excel file to export as a PDF with the date in the name ?
Sub SaveAsPD4()
Dim filename As String
filename = "C:\Users\dazzy_zlpocbd\OneDrive\Desktop\Diary Logs\" & Range("L8").Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
filename, Quality:=xlQualityStandard, IncludeDocProperties _
:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
When I try it with W4 as the cell with the value I get Run Time Error '-2147018887 (80071779)': Document Not Saved
Any ideas how I can get the Excel file to export as a PDF with the date in the name ?
Sub SaveAsPD4()
Dim filename As String
filename = "C:\Users\dazzy_zlpocbd\OneDrive\Desktop\Diary Logs\" & Range("L8").Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
filename, Quality:=xlQualityStandard, IncludeDocProperties _
:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub