![]() |
|
#2
|
||||
|
||||
|
The main problem is that you're not specifying the file type when you save it; merely adding a PDF extension does not a PDF make. Your code could also be greatly simplified. Try:
Code:
Sub SaveDocument()
' this program saves the document in the Suntax Uploads folder on the user's desktop
Dim rng_claimant_id As Range, str_claimant_id As String
With ActiveDocument
Set rng_claimant_id = .Range(Start:=ActiveDocument.Words(1).Start, End:=ActiveDocument.Words(1).End)
str_claimant_id = Left(rng_claimant_id, Len(rng_claimant_id) - 1)
.SaveAs2 FileName:="C:\Users\" & Environ("Username") & "\Desktop\Suntax Uploads\" & _
str_claimant_id & ".pdf", Fileformat:=wdFormatPDF
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Project cannot save - file cannot be opened | Guloluseus | Project | 22 | 01-28-2015 07:23 AM |
| Word Changes File Name When Opened | canonm@pacbell.net | Word | 1 | 06-11-2014 10:04 PM |
| 2007 file opened with 2010 messed up | Intruder | Project | 1 | 11-21-2013 01:04 PM |
| Weird message “the file ( ) should be opened as read-only unless changes to it need t | Jamal NUMAN | Word | 6 | 11-13-2013 01:53 AM |
| 'Save As' to same folder as original opened file | thepuppyprince | Office | 0 | 01-18-2013 08:13 AM |