cancel
Showing results for 
Search instead for 
Did you mean: 

Closing workbook from VBA

Former Member
0 Kudos

Hi.

I have workbook with macro which formats result of query and saves it as pdf file on user's pc.

At the end of execution macro should close current workbook.

I use the code:

ActiveWorkbook.Close (False)

but critical error occurs!

How can i solve this problem?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182470
Active Contributor
0 Kudos

Try with Workbooks("Workbook Name.xls").Close Savechanges:=True

Former Member
0 Kudos

error still occurs

former_member182470
Active Contributor
0 Kudos

Can you check your macro code thoroughly? I was expecting my command would work for you. Close everything and re-open and give a try.

Former Member
0 Kudos

after execution of

Workbooks("Workbook Name.xls").Close Savechanges:=True

screen appears asking me whether to save or not the workbook.

if i answer "yes" or "cancel" workbook remains open and no error

if i asnwer "no" then error


former_member182470
Active Contributor
0 Kudos

Try this : xclapp.ActiveWorkbook.close

Former Member
0 Kudos

what is xclapp?

excel cant find this object

former_member182470
Active Contributor
Former Member
0 Kudos

I have the client components as below:

BI AddOn 7.X (based on 7.30)

Support Package 4, Patch 1

Revision 1938

SAP gui

Release 730 Final release

File version 7300.2.5.1084

Build 1429747

Patch level 5

Could you tell me versions of sap gui and bi addon at your PC?

former_member182470
Active Contributor
0 Kudos

Mine is BI Addon(7.X) Based on 7.20. SAP GUI is 7.20

DId you check the link which I posted to you?