Hi,
I'm having a problem here which I searched in forums and I tried to fix it based on what I learned yet no success. I need solution urgent so I might seek an answer in other forums as well such as ExcelGuru and MrExcel ( Cross post policy)
I wanted to create a macro selects some part of my worksheet and saves it in to the defined directory with the file name in A1.
A1 had the formula as the file name display. I thought it was the problem so I moved the formula to A2, added Copy-Paste Values action to the macro (copy to A1 again) But still the same problem. It gives me an error saying File Not saved. When I click DEBUG, I see whole code block is colored yellow in VBA editor.
Here below is the code
I would appreciate if anyone could point out the mistake....
Sub PP()
'
' PP Macro
'
' Keyboard Shortcut: Ctrl+Shift+P
'
Range("A2").Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1:U86").Select
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Murat Erguden\Dropbox\PLANET\5STAR CHA\PAYROLL\2017\ & Range("A1").Value ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
Application.WindowState = xlNormal
End Sub
Bookmarks