Could you kindly help me with this code? I am a beginner..
Sub ExportSheetstoPDF()
Dim ws As Worksheet
Dim mywsname As String
For Each ws In Worksheets
ws.Select
mywsname = ws.Name
Activesheet.ExportAsFixedFormat Type:=xlTypePDF, _
filename:="Z:\Incent_2022\ORDINARIA\RETAIL-WHS\Schede Obiettivi\Q1\" & "Schede Obiettivi Retail Classico Q1 22_" & mywsname & “.pdf”, _
Next ws
End Sub
CodePudding user response:
Your problem is that the line
Activesheet.ExportAsFixedFormat Type:=xlTypePDF, _
filename:="Z:\Incent_2022\ORDINARIA\RETAIL-WHS\Schede Obiettivi\Q1\" & "Schede Obiettivi Retail Classico Q1 22_" & mywsname & “.pdf”, _
has the continuation character _ at the end of it, but nothing continues on the next line.
Remove the ,_
from the end of the line
Also the “.pdf”
needs to be ".pdf"
i.e. using ordinary double-quotes and not ones copied out of an Office document ("intelligent" double-quotes)