Something strange is happening...!

Glove303

Board Regular
Joined
Dec 18, 2010
Messages
65
I have a procedure that works fine when it is called from another procedure (no variables passed between then 2), and works fine when I step through it manually. However, it just "gives" up when I run it directly.

It fails at the same line of code, but does not report an error, and as I say, stepping through it manually causes now problem.

OldTemp = Application.GetOpenFilename(FileFilter:= _
"Excel Files (*.xls), *.xls", Title:="Please select a file")

If OldTemp = False Then Exit Sub

Application.EnableEvents = False
Set OldTT = Workbooks.Open(OldTemp)
Application.EnableEvents = True

It fails on the penultimate line (Set OldTT = Workbooks.Open(OldTemp))


James.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
How are you running it when you run it directly? From a keyboard shortcut?
 
Upvote 0
Does your shortcut involve the Shift key, and does the workbook that you are opening have code in the Open event? If so, try a shortcut that does not use Shift.
 
Upvote 0
Does your shortcut involve the Shift key, and does the workbook that you are opening have code in the Open event? If so, try a shortcut that does not use Shift.

Yes and Yes!

It is Ctl + Shift + U

And the workbook has a procedure in the open event.

Is this an Excel bug? I will change the shortcut.
 
Upvote 0
Yes, it's a bug. It relates to the use of the Shift key to prevent event code running when you open a file manually.
 
Upvote 0
I know a few bits and pieces, yes. :)
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,723
Members
452,939
Latest member
WCrawford

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