By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

If a workbook is closed directly from excel vba and then opened from code within VBA.

P: 57
What I want to know is that while one excel application is closed by VBA code from module, another excel application has to be opened.
That means, I have written code to open new excel sheet in the Workbook_BeforeClose.

I have written a code like workbooks.open (Path\filename)

If a workbook is closed directly from excel vba and then opened from code within VBA. It is not working.

It is working fine while we close excel application manually. But it is not working while try to do through VBAcode.

Could you Please help me.

I am using Excel 2000.

Musai.
May 10 '08 #1
Share this Question
Share on Google+
2 Replies


Dököll
Expert 100+
P: 2,364
What I want to know is that while one excel application is closed by VBA code from module, another excel application has to be opened.
That means, I have written code to open new excel sheet in the Workbook_BeforeClose.

I have written a code like workbooks.open (Path\filename)

If a workbook is closed directly from excel vba and then opened from code within VBA. It is not working.

It is working fine while we close excel application manually. But it is not working while try to do through VBAcode.

Could you Please help me.

I am using Excel 2000.

Musai.
Greetings, Musai!

I read your post and felt it would be advantageous if code were also posted, you can post at least part of it, or perhaps all, just someone may see what's a miss, all in all it would be a effective way to help you.

You may also find something already posted if you fetch deeper into the pages through search terms up above.

Good luck with the project!

Dököll
May 11 '08 #2

P: 57
Thanks for updates.

In .bas Module, I have written the application after executing some task.

Public sub close_file
ThisWorkbook.Close savechanges:=False
End sub

Ex:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim strfile as Strfile
Strfile=”c:\Test.xls”
Workbooks.Open strfile
End Sub

While try to close the application through VBA code and open another excel application it is not working.

That means I am trying to close through “close_file” the procedure.

It is working fine while try to close manually.

Could anybody tell me about this issue.

Regards
musai
May 12 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.