cancel
Showing results for 
Search instead for 
Did you mean: 

Excel error while saving file in .xlsm format

RajkumarSelvara
Level 3

ERROR: Internal : Could not execute code stage because exception thrown by code stage: SaveAs method of Workbook class failed



------------------------------
Rajkumar Selvaradjou
------------------------------
8 REPLIES 8

Hi Rajkumar,

Can you please confirm if any macro is available in the excel file which you want to save since without macro, it won't allow you to save the file



------------------------------
Ritansh Jatwani
Consultant
EY
Asia/Kolkata
------------------------------

Yes macro is present

------------------------------
Rajkumar Selvaradjou
------------------------------

DaveMorris
Level 14
Did you verify the path it's trying to write to?

------------------------------
Dave Morris
Cano Ai
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

AminPatel1
Level 5
This can occur if the directory you are trying to write to does not exist, or if you don't have write access to that directory.

Also kindly refer below post -
https://community.blueprism.com/communities/community-home/digestviewer/viewthread?GroupId=103&MessageKey=83f5c116-2262-4a7f-b980-4f1a7c28515b&CommunityKey=891bbd6b-b97a-418b-a7f5-475cdbcd9ca1&tab=dig...



------------------------------
Amin Patel
Intelligent Automation Developer
Emerson
Pune India
------------------------------
Amin Patel Intelligent Automation Developer Emerson Pune India

TomaszSukiennik
Level 5
Hi,

Try to duplicate page SaveWorkbookAs  and edit code. Change line
wb.SaveAs(Filename:=filename)
 
to
wb.SaveAs(Filename:=filename, FileFormat:=52)

You could also take file format into variable for support more file extensions.


------------------------------
Tomasz Sukiennik
RPA Developer
Digital Teammates
Europe/Lodz
------------------------------

No issue with path

------------------------------
Rajkumar Selvaradjou
------------------------------

Mohammed_OmerAl
Level 4
Hi Team

Please pass the input as handle and workbook name while using save as action in vbo.

If you are dealing with muliple excel files you will get this error.

Let me know if you have any questions.

Thanks & Regards 

Omer




Hi,

Below link will give you all fileformat number.

https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat

Thanks
Nilesh

------------------------------
Nilesh Jadhav
Senior RPA Specialist
ADP
India
------------------------------
Nilesh Jadhav.
Consultant
ADP,India