#1
|
|||
|
|||
Getting PDF File name from Table
Hi,
I'm printing a word file as PDF but i want to get the filename from: Table 1 Colum 2 Row 6 How can i add this code into this vba code: ActivePrinter = "Microsoft Print to PDF" Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _ wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _ wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _ PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0 If you have another way to save as pdf that's fine for me. I only want to have the name of the document as standard. People need to get the possibility to change the directory as long as it gets the filename from the cell mentioned above. |
#2
|
||||
|
||||
Since you want to be able to change the save folder, you could use something as simple as:
Code:
Sub Demo() Dim StrNm As String StrNm = Split(ActiveDocument.Tables(1).Cell(1, 1).Range.Text, vbCr)(0) With Application.Dialogs(wdDialogFileSaveAs) .Name = StrNm .Format = wdFormatPDF .Show End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to convert table to convert table into iCalendar file? | Weboh | Word VBA | 5 | 12-10-2016 03:07 PM |
Mailmerge to a table from a txt file | troy23 | Mail Merge | 7 | 01-29-2014 04:40 AM |
putting image file into a cell of a table | hklein | Word VBA | 1 | 04-19-2013 03:34 AM |
A Table of Contents that Will Dictate the Content of the File | ddhardy | Word | 0 | 06-23-2010 06:01 AM |
extracting data from Table to text file | Anirudh_Dsp | Word Tables | 1 | 05-23-2010 07:48 AM |