![]() |
|
#3
|
|||
|
|||
|
Quote:
Dear gmayor, I tried to edit your code, in order to save the file automatically under the current folder and name by using the following vars, but I failed (compile error syntax) Code:
Dim CurrentFolder As String Dim FileName As String myPath = ActiveDocument.FullName CurrentFolder = ActiveDocument.Path & "\" FileName = Mid(myPath, InStrRev(myPath, "\") + 1, _ InStrRev(myPath, ".") - InStrRev(myPath, "\") - 1) ...... Application.PrintOut FileName:="FileName", Code:
Sub SavePageRangeAsPDFffffff()
Dim sRange As String
sRange = InputBox("Enter the range of pages to be printed eg 1-3" & "")
If sRange = "" Then
MsgBox "No pages selected!", vbCritical, "Print Pages"
End If
ActiveDocument.ExportAsFixedFormat _
OutputFileName:=CurrentFolder & "Robert" & ".pdf", _
ExportFormat:=wdExportFormatPDF, _
range:=sRange
End Sub
Thank you again |
| Tags |
| word vba, word vba code, word vba macro |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Save File with specific name from fields input. | PM1 | Word | 17 | 10-04-2020 07:22 PM |
| Drag and Drop into an input range results in #REF! error | DJ0691 | Excel | 4 | 02-20-2020 10:16 AM |
Auto generate X pages from input
|
lipatin | Word VBA | 12 | 06-01-2018 12:13 AM |
| Automatically copy/paste a form field onto new pages, with user input included | Pindar | Word VBA | 3 | 01-13-2017 11:49 AM |
Save a range of pages as PDF
|
gn4619 | Word VBA | 9 | 10-27-2015 02:11 PM |