Macro to open a file

B

ben.c

Hi,
I have in 2 different macro the exactly same program to open a file. But in the first one, it is working and in the second one, the program stop after have opened the file.... He just stop as if there is an exit sub after my row.... In the exemple behind, the program does not do the 3rd line.... I am completly lost....
Thanks for any help

Public Sub openfillratio()

ChDir "H:\Charras"
Workbooks.Open Filename:="H:\Charras\Fill Ratio.xls"
Windows("temporaire.xls").Activate

End Sub
 
T

Tom Ogilvy

Are you using a shortcut key to start either of the macros? Is so, does the
shortcut key include the shift key as part of the shortcut combination. If
so, change it so it doesn't require the shift key.

--
Regards,
Tom Ogilvy

ben.c said:
Hi,
I have in 2 different macro the exactly same program to open a file. But
in the first one, it is working and in the second one, the program stop
after have opened the file.... He just stop as if there is an exit sub after
my row.... In the exemple behind, the program does not do the 3rd line.... I
am completly lost....
 
B

ben.c

Yes, Yes, and Yes....it is working without the shift key in the short cut...
Do you know why the shift key does this ?
Thanks a lot for the answer, I was really disapointed.
 
T

Tom Ogilvy

When you hold down the shift key and open a file manually, it disables
macros. Apparently it has the same effect when you use a shortcut key that
includes a shift to fire the macro. When the workbook opens, the macro is
halted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top