I have a script that I want to run in MS Access to export all the worksheets in a late bound selected workbook to individual PDfs in a specific location with the PDF file names being the names of the worksheets. Below is what I have so far, but I am having trouble figuring out what the export code is. I have tried modifying Excel VBA code (Excel VBA to Export Selected Sheets to PDF) to export, but it kept returning compile errors at every step.
Dim xls As Object
Dim wkb As Object
Dim wks1 As Object
Dim wks2 As Object
Dim wks3 As object
Set xls = CreateObject("Excel.Application")
Set wkb = xls.Workbooks.Open("\\EXCHSVR1\stone\Mold_Books\" & mold_id & "\" & Mid(Mid(strFlpath, InStrRev(strFlpath, "/") + 1), InStrRev(strFlpath, "\") + 1))
Set wks1 = wkb.Worksheets(1)
'code to export the first worksheet to "C:\test\" & wks1.name
Set wks2 = wkb.Worksheets(2)
'code to export the second worksheet to "C:\test\" & wks2.name
Set wks3 = wkb.Worksheets(3)
'code to export the third worksheet to "C:\test\" & wks3.name