dannyok90
Board Regular
- Joined
- Aug 30, 2016
- Messages
- 115
Morning All,
I'm fairly new to code and I keep getting errors every time I write some!
I have written this with help from Google etc.
When I run the macro it says 'document not saved, the document may be open, or an error may have been encountered when saving.'
and the debugger is picking up an error on the rng.export line
Note: Ive x'd out some of the file path
Any Help? :D
I'm fairly new to code and I keep getting errors every time I write some!
I have written this with help from Google etc.
When I run the macro it says 'document not saved, the document may be open, or an error may have been encountered when saving.'
and the debugger is picking up an error on the rng.export line
Note: Ive x'd out some of the file path
Any Help? :D
Code:
Sub savepdf()
Dim Rng As Range
Dim fPathFile As String, fncb1 As String
Dim LstRw As Long
LstRw = Cells(Rows.Count, "J").End(xlUp).Row
fncb1 = Range("B1").Value
Set Rng = Range("A1:J" & LstRw)
fPathFile = ("[URL="file://\\XXX.XX\RT\XXXX\DER\XX-XXXXX$\Tasks\XXXXX+\400+\XXXXXX"]\\XXX.XX\RT\XXXX\DER\XX-XXXXX$\Tasks\XXXXX+\400+\XXXXXX[/URL] XXXXXXXX XXXXXX XXXXXXX XXXXXX XXX XXXXXXX\Deliverable")
Rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fPathFile & fncb1 & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
Last edited: