Macro not finishing due to loading workbook

  • Thread starter Thread starter David P.
  • Start date Start date
D

David P.

I have a macro that opens another workbook but it appears that the macro
fails to finish because it's almost like it's not waiting for it to load.
Essentially this is what I'm doing:

Workbook A is open
Macro to open Workbook B (this takes a second to load therefore cancelling
the rest of the macro)
Copy selected text from B
Close Workbook B
Paste info on Workbook A

Your help appreciated.
 
Macro to open Workbook B

How do you execute this macro? Keyboard shortcut?

--
Jim
|I have a macro that opens another workbook but it appears that the macro
| fails to finish because it's almost like it's not waiting for it to load.
| Essentially this is what I'm doing:
|
| Workbook A is open
| Macro to open Workbook B (this takes a second to load therefore cancelling
| the rest of the macro)
| Copy selected text from B
| Close Workbook B
| Paste info on Workbook A
|
| Your help appreciated.
| --
| David P.
 
Now I'm really going to confuse you. I'm assuming the macro stops running at
Workbooks.Open Filename:="C:\Windows Template.xls" .

Sheets("P").Select
Range("I13").Select
Workbooks.Open Filename:="C:\Windows Template.xls"
Sheets("2").Select
Selection.Copy
ActiveWindow.WindowState = xlMinimized
ActiveWindow.WindowState = xlMaximized
ActiveSheet.Paste
ActiveWindow.WindowState = xlMinimized
Windows("Windows Template.xls").Activate
ActiveWindow.Close
 
Yes, by keyboard shortcut.
--
David P.


Jim Rech said:
How do you execute this macro? Keyboard shortcut?

--
Jim
|I have a macro that opens another workbook but it appears that the macro
| fails to finish because it's almost like it's not waiting for it to load.
| Essentially this is what I'm doing:
|
| Workbook A is open
| Macro to open Workbook B (this takes a second to load therefore cancelling
| the rest of the macro)
| Copy selected text from B
| Close Workbook B
| Paste info on Workbook A
|
| Your help appreciated.
| --
| David P.
 
Remove the shift key from the shortcut combination.

Holding down the shiftkey while you're opening a file tells excel not to run the
workbook_open event or the auto_open procedure. And it confuses excel so that
it never goes back to finish your code.
 
What Dave said holds even if the workbook you're opening doesn't have any
macros. It kills the calling macro too.

--
Jim
| Yes, by keyboard shortcut.
| --
| David P.
|
|
| "Jim Rech" wrote:
|
| > >>Macro to open Workbook B
| >
| > How do you execute this macro? Keyboard shortcut?
| >
| > --
| > Jim
| > | > |I have a macro that opens another workbook but it appears that the
macro
| > | fails to finish because it's almost like it's not waiting for it to
load.
| > | Essentially this is what I'm doing:
| > |
| > | Workbook A is open
| > | Macro to open Workbook B (this takes a second to load therefore
cancelling
| > | the rest of the macro)
| > | Copy selected text from B
| > | Close Workbook B
| > | Paste info on Workbook A
| > |
| > | Your help appreciated.
| > | --
| > | David P.
| >
| >
 
Back
Top