Hello,
I'm very fresh to vba, so please forgive me for any easy question.
IIn VBA (excel), I'm opening a word document, filling with values from an xls file and save it. I can save it as .docx but I can't find a way to save it as pdf.
The code i'm trying to use is:
ActiveDocument.ExportAsFixedFormat OutputFileName:= ActiveDocument.Path & "\" & ActiveDocument.Name & ".pdf", ExportFormat:= wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= wdExportOptimizeForPrint, Range:=wdExportAllDocument, Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:=True, UseISO19005_1:=False
(from http://vbadud.blogspot.com/2009/07/h...-document.html).
Vba doesn't recognize all the wd* (enums?).
Please help
Last edited by Xristosk; 10-10-2011 at 06:12 PM.
IF you are using early binding, it would know the values. If you are using late binding, Dim wd as Object, then set the values or use them directly. To find the values, in MSWord's VBE Immediate Window, prefix the constant with a question mark, add the constant variable name, and press enter.
e.g.
?wdExportCreateNoBookmarks
0
Nice! I've tried in excel with no result - I should've done it in Word.
How do I revert the thread to "solved"?
Of course you can set the reference to MicroSoft Word object in Tools > References and and still use late binding but the constants will still be available.
From the FAQ:
To mark your thread solved do the following:
- Go to the first post
- Click edit
- Click Advance
- Just below the word "Title:" you will see a dropdown with the word No prefix.
- Change to Solve
- Click Save
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks