blog banner


Use the VBA SaveAs Method in Excel FileFormat Case FileExtStr = “. xlsx”: FileFormatNum = 51 Case roject Then. I have just started looking at code saving in vba and I am sure this will seem like a stupid question to a lot of you out there. After reading a. Note: This method has been added to the Excel object model with Excel and requires the Save as PDF or XPS Add-in for Microsoft Office programs to.

Author: Zulkiran Kami
Country: Zambia
Language: English (Spanish)
Genre: Finance
Published (Last): 7 March 2008
Pages: 164
PDF File Size: 7.46 Mb
ePub File Size: 3.89 Mb
ISBN: 848-2-67908-579-8
Downloads: 22343
Price: Free* [*Free Regsitration Required]
Uploader: Diran

Use the VBA SaveAs Method in Excel 2007

Select ‘ End With ‘ Application. The file send in outlook has this name: If you always want to save in a certain format you can replace this part of the macro:. By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of the website is subject to these policies.

October 25th, By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. I need to call a function in order to save an Excel workbook. Runs best on HiVelocity Hosting. If the parent workbook is not an. In Excel versions before Excelcode without this parameter will not cause too many problems because Excel will use the current FileFormat of the existing file and the default FileFormat for new files is a xls in because there are no other Excel file formats before Excel How can I be notified when my favorite forums contain new threads?


I got most of this code from online and understand the basics of how it works, but am having trouble editing it to do what I want.

fileformantum Examples Below are two basic code examples to copy the ActiveSheet to a new Workbook and save it in a format that matches the file extension of the parent workbook. The more you know!

Post as a guest Name. Excellent – though I filformatnum the last parameter to have another name OpenAfterPublish. Force SaveAs with macro-enabled sheet try You can find more useful tips and links to Excel add-ins at his website: Only if the parent workbook is an xlsm file and if there is no VBA code in the new workbook it will save the new file as xlsx.

The issues i’m facing are: I have a similar issue to this thread except that the spreadsheet does need to be saved as a macro-enabled sheet.

If you run the code filefoematnum Excel it will look at the FileFormat of the parent workbook and save the new file in that format. All times are GMT The only issue I am having is with saving the selection as a PDF. fileformatnkm

Force SaveAs with macro-enabled sheet – Free Excel\VBA Help Forum

Thread Tools Show Printable Version. Found out the problem was my code included e-mails. Saving Worksheet as PDF. I tried saving it from the VB window but it still triggers the SaveAs code.

Thank you so much for any help you can give! Maybe there’s nothing that I’m setting it to? Sign up or log in Sign up using Google. This works so well that it always saves as the calculated file name. An example of the excel file format numbers can be found here. If you always want to save in a certain format you can replace this part of the macro: Forums Blogs Articles Groups.


Fba have done some programming before so I’ve been trying to piece together what I’ve been able to find from the internet. That said, your code could be simplified and made more efficient.

xlFileFormat enumeration (Excel)

Thanks in advance for you r time and help. If you run the code in Excelit will look at the FileFormat of the parent workbook and save the new file in that format. I keep getting the error message: You see a lot of old SaveAs code that does not specify the FileFormat parameter. Username Changing provided by Username Change v1.

How do I configure the display of members’ images and signatures? How do I bypass the BeforeSave event to save the original template document if I make changes to it? Force SaveAs with macro-enabled sheet Thanks for all your help but I have another question.