I have the following code to create a PDF and save this PDF to a folder (input in sheet "Menu" and cell "A4").
We have a team OneDrive and I've tried simply input the URL in "Menu" and cell "A4 without success. Is there something else I should be doing?
Thanks in advance.
We have a team OneDrive and I've tried simply input the URL in "Menu" and cell "A4 without success. Is there something else I should be doing?
Thanks in advance.
VBA Code:
Sub PDFPrintALL()
Dim ReportPath As Variant
Dim ReportName As Variant
Dim ToPrint As Variant
Dim strSheet As Variant
Set ReportPath = Sheets("Menu").Range("A5")
Set ReportName = Sheets("Menu").Range("A3")
Set ToPrint = Sheets("Menu").Range("A4")
strSheet = Sheets("Menu").Range("A6")
Sheets(strSheet).Activate
On Error Resume Next
With ActiveSheet
.PageSetup.PrintArea = ToPrint
.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=ReportPath & ReportName & ".PDF", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
On Error Resume Next
End With
MsgBox " PDF document:" & vbCrLf & "File Name: " _
& ReportName & vbCrLf & vbCrLf & " Has been created and has been saved to:" _
& vbCrLf & v
End Sub