Hi,
I'm trying to write a macro in a Word document (Testdoc.doc) that will print the file Testdoc.doc to a pdf file. This is the function (in Visual Basic) in the macro that does that:
Public Sub bd2pdf_print(Printer As String, FilePath As String, OutputFile As String)
ActivePrinter = Printer
Application.PrintOut FileName:=FilePath, Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="1", PageType:=wdPrintAllPages, _
Collate:=True, Background:=False, PrintToFile:=True, OutputFileName:=OutputFile, _
Append:=False
End Sub
Public Sub bd2pdf_close()
ActiveDocument.Close wdDoNotSaveChanges
End Sub
The parameters "Printer, FilePath, OutputFile" are submitted by a Visual Basic program that I have.
So in that program, I open the word document and then use the command: docapp.Run "bd2pdf_close" (where docapp is Word application) to run the macro. I actually manage to generate a pdf file, but there is something wrong with it. So I wonder if maybe this is correct what I do?
Grateful for help!