سلام دوستان
با این کد میتونید شیت مورد نظر رو به PDF تبدیل کنین و جالب اینکه میتونین از سه تا سلول یا بیشتر به عنوان اسم فایلتون انتخاب کنید
با این کد میتونید شیت مورد نظر رو به PDF تبدیل کنین و جالب اینکه میتونین از سه تا سلول یا بیشتر به عنوان اسم فایلتون انتخاب کنید
کد:
[COLOR=#E56717][FONT=Consolas][B]Sub[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas] SaveAsPDF()[/FONT][/COLOR] [COLOR=#008000][FONT=Consolas]'Saves active worksheet as pdf using concatenation [/FONT][/COLOR][COLOR=#008000][FONT=Consolas]'of A1,A2,A3 [/FONT][/COLOR] [COLOR=#151B8D][FONT=Consolas][B]Dim[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas] fName [/FONT][/COLOR][COLOR=#151B8D][FONT=Consolas][B]As[/B][/FONT][/COLOR][COLOR=#F660AB][FONT=Consolas][B]String[/B][/FONT][/COLOR] [COLOR=#8D38C9][FONT=Consolas][B]With[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas] ActiveSheet[/FONT][/COLOR] [COLOR=#141414][FONT=Consolas] fName = .Range([/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"A1"[/FONT][/COLOR][COLOR=#141414][FONT=Consolas]).Value & .Range([/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"A2"[/FONT][/COLOR][COLOR=#141414][FONT=Consolas]).Value & .Range([/FONT][/COLOR][COLOR=#800000][FONT=Consolas]"A3"[/FONT][/COLOR][COLOR=#141414][FONT=Consolas]).Value[/FONT][/COLOR] [COLOR=#141414][FONT=Consolas] .ExportAsFixedFormat [/FONT][/COLOR][COLOR=#151B8D][FONT=Consolas][B]Type[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas]:=xlTypePDF, Filename:= _[/FONT][/COLOR] [COLOR=#800000][FONT=Consolas]"C:\My Documents\"[/FONT][/COLOR][COLOR=#141414][FONT=Consolas] & fName, Quality:=xlQualityStandard, _[/FONT][/COLOR] [COLOR=#141414][FONT=Consolas] IncludeDocProperties:=[/FONT][/COLOR][COLOR=#00C2FF][FONT=Consolas][B]True[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas], IgnorePrintAreas:=[/FONT][/COLOR][COLOR=#00C2FF][FONT=Consolas][B]False[/B][/FONT][/COLOR][COLOR=#141414][FONT=Consolas], OpenAfterPublish:=[/FONT][/COLOR][COLOR=#00C2FF][FONT=Consolas][B]False[/B][/FONT][/COLOR] [COLOR=#8D38C9][FONT=Consolas][B]End[/B][/FONT][/COLOR][COLOR=#8D38C9][FONT=Consolas][B]With[/B][/FONT][/COLOR] [COLOR=#8D38C9][FONT=Consolas][B]End[/B][/FONT][/COLOR][COLOR=#E56717][FONT=Consolas][B]Sub [/B][/FONT][/COLOR]
کامنت