Keyboard Shortcut Only Runs Part of the Macro

J

Jonnyboy117

I'm trying to run the following macro with a keyboard shortcut applied:


Sub MainPlot()
'
' MainPlot Macro
' Macro recorded 7/9/2004 by Jonathan G. Metts
' Keyboard Shortcut: Ctrl+Shift+M
Dim Message

ChDir _
"C:\Program Files\Microsoft Visual Studio\Common\MSDEV98\M
Projects\msic2003_mod"
Workbooks.OpenText Filename:= _
"C:\Program Files\Microsoft Visual Studio\Common\MSDEV98\M
Projects\msic2003_mod\rangedata.txt" _
, Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth
FieldInfo:= _
Array(Array(0, 1), Array(12, 1), Array(28, 1), Array(44, 1)
Array(60, 1), _
Array(76, 1), Array(92, 1), Array(108, 1), Array(124, 1))

Call AltRangePlot
Call AltTimePlot
Call AoATimePlot
Call MachTimePlot
Call RangeTimePlot
Call ThrustTimePlot
Call VelocityTimePlot
Call WeightTimePlot
Message = MsgBox("When you are ready to plot the geometry in 3D
press Ctrl+Shift+T to " _
& "activate the RunTecplot macro." & Chr(13) & Chr(13) & "(
new Workbook will open, but you " _
& "can easily switch back to this one.", vbOKOnly)
End Sub


As you can see, it's basically a calling program which runs throug
several other macros. I've set the keyboard shortcut for this macro t
Ctrl+Shift+M in the Macro Options, and the macro itself works perfectl
when I click Run from the list of macros (Alt+F8). But if I run i
with the keyboard shortcut, the text file opens but none of the othe
macros are run.

So basically, the macro runs one way (correctly) when run through th
menus, and it runs another way (incompletely) when run with th
keyboard shorcut. It might be useful to note that I didn't include
keyboard shortcut when I originally created this macro; I added i
later by going to the list of macros and clicking on Options.

Any ideas
 
D

Dave Peterson

Try a shortcut without the shift key.

If you hold the shift key down when open a workbook, you disable the
auto_open/workbook_open code. And when you use a shortcut key that includes the
shift, excel gets confused and stops running the macro you just started.
 

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