Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 02-20-2019, 01:24 PM
g_stuckey g_stuckey is offline Windows 10 Office 2016
Novice
 
Join Date: Feb 2019
Location: Alabama, USA
Posts: 2
g_stuckey is on a distinguished road
Default Print or export a single section to PDF

Hi All,

I'm Ginger, a technical writer using Word 2016/365. I'm just learning VBA but I have an urgent request from my customer to print, save, or export a specific section to PDF on a button click. I'm not there yet.

I've done some research and found pieces of information that I only understand partially (because, seriously, I'm just starting out) so I know it can be done. I just need some help.

I found the following but it is for Word 2003. I tried it but it didn't work:

With Dialogs(wdDialogFilePrint)
.Background = True
.Pages = "s1"
.Execute
End With

I understand that it doesn't solve the straight to PDF issue but users can choose PDF.

Ideally, users can click a button above the section break to convert to PDF and open the Save dialog box.

Sorry to be a pain as a noob.

Ginger
Reply With Quote
  #2  
Old 02-20-2019, 04:08 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,150
Guessed has a spectacular aura aboutGuessed has a spectacular aura aboutGuessed has a spectacular aura about
Default

Ginger
You should be using a different command
ActiveDocument.ExportAsFixedFormat is the command you should be using. You can provide parameters such as exportformat and range
Refer to https://docs.microsoft.com/en-us/off...%3D-2147217396
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 02-21-2019, 05:55 AM
g_stuckey g_stuckey is offline Windows 10 Office 2016
Novice
 
Join Date: Feb 2019
Location: Alabama, USA
Posts: 2
g_stuckey is on a distinguished road
Default

Thank you very much!

G.
Reply With Quote
Reply

Tags
macro, pdf, word section

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to print on a single sheet xexeu Excel 0 10-09-2018 01:57 PM
Export single category from contacts list ksimmonds Outlook 0 04-25-2018 02:04 AM
Footnote numbering problem within single section jsswadley Word 2 03-17-2015 04:44 PM
Outlook export to a calendar csv file is transposing single digit starting dates sala-marie Excel 3 10-27-2013 09:32 PM
Export data from multiple attachments into a single excel document Woolstar Outlook 0 12-07-2011 09:49 AM


All times are GMT -7. The time now is 06:10 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft