If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Keyboard Shortcut Only Runs Part of the Macro
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\My Projects\msic2003_mod" Workbooks.OpenText Filename:= _ "C:\Program Files\Microsoft Visual Studio\Common\MSDEV98\My 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) & "(A 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 through several other macros. I've set the keyboard shortcut for this macro to Ctrl+Shift+M in the Macro Options, and the macro itself works perfectly when I click Run from the list of macros (Alt+F8). But if I run it with the keyboard shortcut, the text file opens but none of the other macros are run. So basically, the macro runs one way (correctly) when run through the menus, and it runs another way (incompletely) when run with the keyboard shorcut. It might be useful to note that I didn't include a keyboard shortcut when I originally created this macro; I added it later by going to the list of macros and clicking on Options. Any ideas? --- Message posted from http://www.ExcelForum.com/ |
#2
|
|||
|
|||
Keyboard Shortcut Only Runs Part of the Macro
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. "Jonnyboy117 " wrote: 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\My Projects\msic2003_mod" Workbooks.OpenText Filename:= _ "C:\Program Files\Microsoft Visual Studio\Common\MSDEV98\My 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) & "(A 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 through several other macros. I've set the keyboard shortcut for this macro to Ctrl+Shift+M in the Macro Options, and the macro itself works perfectly when I click Run from the list of macros (Alt+F8). But if I run it with the keyboard shortcut, the text file opens but none of the other macros are run. So basically, the macro runs one way (correctly) when run through the menus, and it runs another way (incompletely) when run with the keyboard shorcut. It might be useful to note that I didn't include a keyboard shortcut when I originally created this macro; I added it later by going to the list of macros and clicking on Options. Any ideas? --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
#3
|
|||
|
|||
Keyboard Shortcut Only Runs Part of the Macro
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
macro shortcut key won't work | SLynn | General Discussion | 2 | July 12th, 2004 03:00 PM |
Office 2003 / Office XP Shortcut Bar | Marc Bressman | Setup, Installing & Configuration | 6 | June 26th, 2004 08:42 AM |
Office 2003 / Office XP Shortcut Bar | Marc Bressman | General Discussions | 6 | June 26th, 2004 08:42 AM |
Keyboard Shortcut to close task pane | Remove Animal from email address | Setup, Installing & Configuration | 2 | June 17th, 2004 04:22 AM |
Creating keyboard shortcut keys and normal.dot | Sheila | General Discussion | 11 | May 21st, 2004 04:54 AM |