Got it all working except for whrn I DO want to overwrite the existing file. Creates pdf if it does not exist ok. Finds the file if it exists and pops dilaog box ok. If I click NO it ends the macro. If I hit YES it ends the macro but fails to save the file.
Any thoughts?
vFileName = Range("O10").Text
If Dir("V:\Common\Loki\GTRs\" & (vFileName)) <> "" Then
MsgBox "This GTR File Already Exists!" & Chr(13) & "Overwrite?", Buttons:=308, Title:="GTR Overwrite Yes/No"
If Response = vbYes Then
Sheets("GTR").ExportAsFixedFormat Type:=xlTypePDF, Filename:=("V:\Common\Loki\GTRs\" & (vFileName)), Quality:=xlQualityStandard, OpenAfterPublish:=True
Else
End If
Else
Sheets("GTR").ExportAsFixedFormat Type:=xlTypePDF, Filename:=("V:\Common\Loki\GTRs\" & (vFileName)), Quality:=xlQualityStandard, OpenAfterPublish:=True
End If
Still working on it but any help is appreciated. Did have to get rid of the ChDir line as using the Dir function seemed to disrupt it and even if I reapplied it right above the export function, it didn't seem to take. Just built the path in the export function to get around that though. I know there is probably a way to point to the export function without having to have it there twice but I'll diddle with that later.
Thanks... Doug
Bookmarks