MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Opening 2 copies of Excel (again)


Posted by Tee on June 20, 2001 3:48 PM

I am trying again for some help with this.

I have created an excel program that has a Auto Open macro. Named A

I made a copy of this and renamed it B and saved it in another location (different drive on network).

When I open A either directly from the shortcut on my desktop or from File, Open etc.

Both files are opening. I am not aware of this until I go to close A and I am then asked 'Do I want to save the changes in B'

Any suggestions for a solution would be greatly appreciated as this is giving me the willy's!!!

Tee


Posted by Russell on June 20, 2001 4:12 PM

Post your code?

Viewing the code might help somebody give an answer....

Posted by Tee on June 20, 2001 4:39 PM

Here is the Code

This is the AutoOpen from A.(VSU_Register)

Sub Auto_Open()
Application.ScreenUpdating = False
Application.OnSheetActivate = "TrapKey"
Sheets("VSU").Select
Application.Run "VSU_Register.xls!Max_Prepare"
End Sub

And here is B(NH_Register01)
Private Sub Auto_Open()
Application.ScreenUpdating = False
Application.OnSheetActivate = "TrapKey"
Sheets("VSU").Select
Application.Run "NH_Register01.xls!Max_Prepare"
End Sub

Is it possible that the macros are ? connected some way as the 2nd file only opens when I run a macro.

Cheers Tee.

Posted by Russell on June 20, 2001 5:05 PM

Re: Here is the Code

Try looking at the links of both workbooks (Edit-Links). If there are any external links, then you may have found your problem...

Hope this helps!

Russell

Posted by Damon Ostrander on June 20, 2001 10:40 PM

Re: Here is the Code

Russell,

On looking at your code, here is what I believe is happening:

In your Auto_Open procedure in workbook named VSU_register.xls you have the line of code:

Application.Run "VSU_Register.xls!Max_Prepare"

Since you gave it an explicit file name, but no path, it goes to the default (working) directory to find it. If the instance of VSU_register.xls in this directory is not the same instance of the VSU_register.xls workbook that this code is running within (the one you opened), Excel has to open it as well. If you really wanted it always to look for the Max_Prepare macro within the workbook that you first open simply replace the Application.Run statement with:

Max_Prepare

which Excel will always look for within the active workbook.

Good luck!

Damon

Posted by Jerid on June 21, 2001 11:25 AM

Hi Tee,

I have seen this happen before, if I remember correctly you need to open one of the files (Both should Open), then close one and do a file SaveAs,and pick a new name. Repeat the process for the other file.

Jerid