Save excel as PDF in current folder using current workbook ...
文章推薦指數: 80 %
Save an Excel PDF sheet in the same directory as my Excel file Resultsfromthe2022DeveloperSurveyarenowavailable Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. Learnmore Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore SaveexcelasPDFincurrentfolderusingcurrentworkbookname AskQuestion Asked 5years,2monthsago Modified 4years,11monthsago Viewed 11ktimes 0 TryingtosaveasetofsheetsfromaworkbooktoPDFformattothesamefolderandusingworkbookname. AfterrecordingthemacrowithallthestepswentbackandtriedtoreplacethepiecesofthecodebywhatIfoundinsomeofthisforum'sthreadsbutnowitisnotworking. Currentversionisbelow. WhatdidIbreak? SaveToPDFMacro Sheets(Array("AUDITInfo","REVIEW","FILES","WARNINGS","PURGE","NonBIM",_ "Clashes","ViewsManagement")).Select Sheets("AUDITInfo").Activate ActiveSheet.ExportAsFixedFormatType:=xlTypePDF,Filename:=_ ThisWorkbook.Path&"\"&ActiveWorkbook.Name_ ,Quality:=xlQualityStandard,IncludeDocProperties:=True,IgnorePrintAreas_ :=False,OpenAfterPublish:=True Sheets("AUDITInfo").Select vbaexcelpdf Share Improvethisquestion Follow editedApr11,2017at19:41 YowE3K 23.7k77goldbadges2525silverbadges4040bronzebadges askedApr11,2017at11:51 JoaquimAgostinhoJoaquimAgostinho 1711goldbadge11silverbadge66bronzebadges 0 Addacomment | 2Answers 2 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 1 Trythecodebelow: OptionExplicit SubSaveSheetsasPDF() ThisWorkbook.Sheets(Array("AUDITInfo","REVIEW","FILES","WARNINGS","PURGE","NonBIM","Clashes","ViewsManagement")).Select ActiveSheet.ExportAsFixedFormatType:=xlTypePDF,Filename:=_ ThisWorkbook.Path&"\"&ThisWorkbook.Name,_ Quality:=xlQualityStandard,IncludeDocProperties:=True,_ IgnorePrintAreas:=False,OpenAfterPublish:=True EndSub Share Improvethisanswer Follow answeredApr11,2017at11:56 ShaiRadoShaiRado 32.6k66goldbadges2222silverbadges4646bronzebadges 2 Itisworking.Thankyouverymuch.ButthecreatedPDFisincludingthe[filename].xlms.pdfextension.HowcanIremovethe"xlms"bit? – JoaquimAgostinho Apr11,2017at13:26 gotitjustadded.DimNameOfWorkbookNameOfWorkbook=Left(ThisWorkbook.Name,(InStrRev(ThisWorkbook.Name,".",-1,vbTextCompare)-1)) – JoaquimAgostinho Apr11,2017at13:35 Addacomment | 0 Youwillgetanerrorifbeforerunningthemacrooneoftheneededsheetswillbeselected/activated..that'swhyyouneedtoaddthefirstline sheets(1).select wherethefirstsheetisn'tinyourarray Share Improvethisanswer Follow answeredApr11,2017at12:41 ArtemArtem 3255bronzebadges 0 Addacomment | YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedvbaexcelpdforaskyourownquestion. TheOverflowBlog CelebratingtheStackExchangesitesthatturnedtenyearsoldinSpring2022 GitHubCopilotishere.Butwhat’stheprice?(Ep.457) FeaturedonMeta Testingnewtrafficmanagementtool Duplicatedvotesarebeingcleanedup Trending:Anewanswersortingoption AskWizardTestResultsandNextSteps Shouldweburninatethe[hyphen]tag? Updatedbuttonstylingforvotearrows:currentlyinA/Btesting Visitchat Linked 0 SavingdocumentasaPDFwithmodifiedfilename 0 ExporttoPDFwhendocumentisgoingtoexpand Related 261 LoopthroughfilesinafolderusingVBA? 605 HowtoavoidusingSelectinExcelVBA 0 ExportEXCELWorkbookasPDFthroughSAP 0 ReferringtoWorkbook/Worksheetwithvariablenames 0 ExcelWorkbooktoPDFMacroError 1 ExcelworkbooktoSaveAs.pdf 1 VBAprint/export/saveallExcelworkbooktabsintoonePDFdocument 0 ExcelVBAmacrotosaveexcelworkbooktopdfwillnotsave HotNetworkQuestions Doingalittletrollingwiththemicrowavetimer Howtostopfraudulentrecurringcreditcardtransactionsbeingforwardedtonewcard? Howdoyoukeepanantagonistasmorallygreyevenaftertheycauseseriousharm/conflict? Howto(safely)permanentlyturnoffnaturalgas? HowcanIremovealluvlayersbutthelastoneandrenameitonmultipleobjects? Gettingridof"ThefollowingpackageswillbeDOWNGRADED" Whatactuallyistheideabehindthecondensedmathematics? Whywouldanationrequireimmigrantstofulfiladecadeofmilitaryservicetogaincitizenship? Whatisthenameofthejobwhorepresentsafamilytrusttomanagefixedassets IsFrederic21or22in"PiratesofPenzance"? Diseasethatrapidlykillsandreplacescells-severityofsymptoms Doesgridsearchonrandomforestmakesense? Whydoest-statisticforarbitraryparameterfollowtdistribution? Fibonaccipolynomials Whatnon-toxicnon-corrosiveliquidsareusedforheattransfer? Howcanweexperimentallyconfirmthatatoms/moleculesinasolidactually"move"? What'sthetypicaltemperatureofareactorcoreinanuclearthermalrocket? HowdidtheSun-1handlepagefaultsdespitehavingtheoriginal68000processor? Whatwordstodescribethethreemonomolecularstructures Docountries(withruleoflaw)existwhereacourtcanrequirethelegislaturetovoteonalawinordertoclearambiguities? DidVolodymyrZelenskyysaythat"ifsomeoneinUkrainefeelsRussian,theyshouldleaveforRussia"? Howcouldonedistinguishcrankeryfromseriouswork? WhydidoldconsoleshavespecialRAMdedicatedforaspecifictask? Fullcoveragefenderswithoutchainstaybridge? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. lang-vb Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings
延伸文章資訊
- 1Excel VBA Save As PDF: Step-By-Step Guide And 10 Examples
If you're creating a macro to save Excel files as PDF, and those PDF files must always be saved i...
- 2How to Save a PDF File with a Specific User-Defined Path in ...
A simple VBA macro program script will be able to open or display a dialog window, asking the use...
- 3Excel VBA program save a copy of file to same directory as ...
I want the code to save the copy in the same directory as the original document a folder called "...
- 4Excel VBA Macro to Save PDF in Specific Folder (7 Ideal ...
This tutorial will demonstrate different examples to use Excel VBA macro to save as PDF in a spec...
- 5VBA - Save Invoice Worksheet as PDF - to Specific Folder