Link to home
Start Free TrialLog in
Avatar of Toucanier
ToucanierFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Check in PDF document to SharePoint from Excel using VBA

Hi

Can anyone post some simple vba code that I can plug in to my own code to allow me to automatically check in PDF files that have just been automatically created and saved on a SharePoint site?

I'm using the simple procedure, below, which works but means that I have the inconvenience of having to do manual check-ins afterwards.

Sub SaveAsPDF(ByVal theFileName As String, theID As String)

    Dim myPath As String
        
    Sheets(theID).Select
    
    myPath = Range("IssueDefectPath") & theFileName & ".pdf"
    
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=myPath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
   
    ActiveWorkbook.Save
    
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
just verified to code and it works :-)
(at least on my demo machine)
Avatar of Toucanier

ASKER

Thanks very much for this. I only needed to tweak a few variables and it worked perfectly. This will save me many hours of mundane work when automatically creating PDFs.