code to return to active workbook

G

Guest

Guest
I am using code to open another workbook from an open workbook.
In the workbook "SheetChange"module I have:
Workbooks.Open Filename:="P:trial5.xls"
works fine...

After I update the ("Trial5") workbook, and close it, I get an EXE crash. I think I need to write the code to return and activate the original workbook ("PSFDB2"), but I dont know the code.

Workbook.activate filename:="P:PSFDB.xls"....won't work

Thanks
Wrecker
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
On 2002-03-08 06:13, Anonymous wrote:
I am using code to open another workbook from an open workbook.
In the workbook "SheetChange"module I have:
Workbooks.Open Filename:="P:trial5.xls"
works fine...

After I update the ("Trial5") workbook, and close it, I get an EXE crash. I think I need to write the code to return and activate the original workbook ("PSFDB2"), but I dont know the code.

Workbook.activate filename:="P:PSFDB.xls"....won't work

Thanks
Wrecker
Since your workbook is already open you don't need the path in your file name. This will work also:

Workbooks("PSFDB.xls").Activate

I'm curious if this will solve your problem. Please let me know if it does.

Regards,
 
Upvote 0

Forum statistics

Threads
1,213,535
Messages
6,114,192
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top