Mickey the Gr8 Posted November 28, 2018 Posted November 28, 2018 I need to know how to save a new excel workbook to a location of my choosing. I want to be able to open a new workbook, add data, and then save it in a folder in my project folder. I can do everything but save it to the new location. This is what I have so far. (vl-load-com) (setq FilePath "T:\\reference material\\fuse_list_template.xls") (setq ExcelApp (vlax-get-or-create-object "Excel.Application")) (vla-put-visible ExcelApp :vlax-true) (vlax-put-property ExcelApp "DisplayAlerts" :vlax-false) (setq Wbk (vl-catch-all-apply 'vla-open (list (vlax-get-property ExcelApp "WorkBooks") FilePath))) From here I am adding data from autocad electrical 2011 which works fine. My problem is I want to save this to a location that is not the same as the original filepath. I cannot find the code to do a "save as" to the excel workbook. Any help would be appreciated. It should not be this complicated. Thanks. Quote
Lee Mac Posted November 28, 2018 Posted November 28, 2018 Simply use the saveas method of the workbook object. Quote
Mickey the Gr8 Posted November 28, 2018 Author Posted November 28, 2018 Thanks. I think I overcomplicated it. My coworker also gave me a fix. (vlax-invoke-method mywb "saveas" fuse_list_loc msxl-xlnormal "" "" :vlax-False :vlax-False nil) (vlax-invoke-method xl 'QUIT) (vlax-release-object xl) My lisp will now grab all of the fuse attributes from our panel layout in ACADE and organize it into a spreadsheet and save it in the project folder automatically. this gives us a Fuse list we can print out and stick in our panels with no effort, anymore. If you are interested in seeing what I did, I can send you a copy of the .lsp I love Autolisp thanks for the help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.