C with no eyes
Board Regular
- Joined
- Nov 26, 2016
- Messages
- 152
Hi,
I have seen many other threads in relation to this however I cannot seem to get it to work. I'm sorry for repeating this question but I've tried so many variations and have given up.
This code does work:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"S:\Month & Year End Documents\Sales Ledger Month End\Daily turnover\Daily turnover.pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
But I want the file name to be "Daily turnover [date shown in cell g1] and cell g1 is actually a merged cell spanning g1:h2
So far I have this but it highlights yellow and requests debugging:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"S:\Month & Year End Documents\Sales Ledger Month End\Daily turnover\Daily turnover " & Range("G1").Value & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Do I need to format the date? Or is it because g1 is a merged cell?
Can anyone help me, please? I am using Excel 2010
I have seen many other threads in relation to this however I cannot seem to get it to work. I'm sorry for repeating this question but I've tried so many variations and have given up.
This code does work:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"S:\Month & Year End Documents\Sales Ledger Month End\Daily turnover\Daily turnover.pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
But I want the file name to be "Daily turnover [date shown in cell g1] and cell g1 is actually a merged cell spanning g1:h2
So far I have this but it highlights yellow and requests debugging:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"S:\Month & Year End Documents\Sales Ledger Month End\Daily turnover\Daily turnover " & Range("G1").Value & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Do I need to format the date? Or is it because g1 is a merged cell?
Can anyone help me, please? I am using Excel 2010