Public Function ConvertFile(strSourceFileName As String) As Boolean
On Error GoTo ErrorHandler
Dim msExcel As Excel.Application
Set msExcel = GetObject(Class:="Excel.Application")
Dim p As String
p = "Acrobat Distiller on Ne00:"
msExcel.Visible = False
strMenuFilePs = strSourceFileName
msExcel.ActiveWorkbook.PrintOut ActivePrinter:=p, PrintToFile:=False, PrToFileName:=strMenuFilePs
strMenuFilePDF = "c:\try.pdf"
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF strMenuFilePs, strMenuFilePDF, ""
Set myPDF = Nothing
' Should check and quit excel when done
Set msExcel = Nothing
ConvertFile = True
' Create Excel for the first time if it is not active
If Err.Number = 429 Then
Set msExcel = CreateObject("Excel.Application")
Err.Clear ' Clear Err object in case error occurred.
' All other errors handled here
If IsCriticalError Then
ConvertFile = False
I have a VB script which saves worksheets as its own workbook. How could I get it to save it as a pdf? I'm using Adobe Acrobat Professional and its Reference Libraries.
Dim s as String, sh as worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Visible Then 'ignores hidden sheets
s = "c:\Separated Sheets\" & sh.Name 'location and names of workbooks
Range("A1:IV5000").Copy 'selects all cells
Range("A1").PasteSpecial Paste:=xlPasteValues 'pastes values only
Application.CutCopyMode = False
Range("A1").Select 'this is just to take the cursor
'back to the top to make that sheet a litte "cleaner"
Im trying to automaically save an excel file to pdf file using visual basic. So, I will manually open the excel, upon opening the excel file, it will run code to calculate a daily totalizer(this I have functioning) as soon as this code finishes, I want the excel file to print/save to pdf and close. I apologize, I'm a bit of a beginner. thanks
Thanks for the advice and direction. I started a new thread for my question. I'm not sure how a person finds my new thread, short searching for it. I currently reviewing the post you forward the link on to me. thanks pbunkers
I am working creating a fully encapsulated, homogeneous singly linked data structure. The Listing class and SinglyLinkedList class that are part of the whole application compile fine, but the problem ...