![]() |
#1
|
|||
|
|||
![]()
hi all,
i'm trying to create a command button in word and attach a macro that automatically saves the doc as a pdf to a specified folder with file with the name coming from 2 bookmark references with a space and dash in between name. here is what i have so far: Private Sub CommandButton1_Click() ActiveDocument.ExportAsFixedFormat OutputFileName:= _ "C:\Users\sesa460426\Box Sync\My Projects\Quotes" & ClientName = .Bookmarks("ClientName").Range.Text&.Bookmarks("Qu oteNumber").Range.Text & (".pdf"), _ ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _ wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _ Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _ CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ BitmapMissingFonts:=True, UseISO19005_1:=False ChangeFileOpenDirectory "C:\Users\sesa460426\Box Sync\My Projects\Quotes" End Sub i keep getting an invalid or unqualified reference error and it highlights the .bookmarks part. i'm very very new to vba so if someone can please help me. ps. i've also tried adding activedocument before the .bookmarks part but then i get a different error. thanks in advance |
Tags |
bookmarks, macro in word, save as pdf |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
youseeme | Word VBA | 9 | 09-16-2016 05:25 AM |
![]() |
tomsrv | Word VBA | 13 | 08-24-2016 02:26 AM |
![]() |
rvessio | Word VBA | 4 | 07-25-2016 12:37 PM |
Find Bookmark, move to bookmark, execute code, repeat | raymm3852 | Word VBA | 10 | 04-15-2016 06:21 PM |
![]() |
xscotsmanx | Word VBA | 1 | 07-17-2011 12:23 AM |