Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-05-2017, 09:18 AM
pamtupac pamtupac is offline macro to save as pdf with name from bookmark Windows 10 macro to save as pdf with name from bookmark Office 2016
Novice
macro to save as pdf with name from bookmark
 
Join Date: Jun 2017
Posts: 2
pamtupac is on a distinguished road
Default macro to save as pdf with name from bookmark

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
Reply With Quote
 

Tags
bookmarks, macro in word, save as pdf



Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to save as pdf with name from bookmark Macro to Insert Logo in header on 1st page only and bookmark it. youseeme Word VBA 9 09-16-2016 05:25 AM
macro to save as pdf with name from bookmark Macro to return a word count of text contained within a bookmark tomsrv Word VBA 13 08-24-2016 02:26 AM
macro to save as pdf with name from bookmark Macro to save as pdf with ability to choose save as folder 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
macro to save as pdf with name from bookmark Default Save AS File Name from Bookmark xscotsmanx Word VBA 1 07-17-2011 12:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:50 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft