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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,211,789
Messages
6,103,986
Members
447,889
Latest member
birdman15

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