Macro fine Run fine from Select but not from KB Shortcut?
2003 & 2007
What could cause a macro fine run fine from "Select Run" but not from KB Shortcut? Just in case, I changed the KB Shortcut but still the issue. BTW same result on different computers. Any thoughts appreciated! EagleOne |
Macro fine Run fine from Select but not from KB Shortcut?
Make sure the short-cut is not assigned to two macros.
-- Gary''s Student " wrote: 2003 & 2007 What could cause a macro fine run fine from "Select Run" but not from KB Shortcut? Just in case, I changed the KB Shortcut but still the issue. BTW same result on different computers. Any thoughts appreciated! EagleOne |
Macro fine Run fine from Select but not from KB Shortcut?
Does your code open another workbook and fail right after it opens that
workbook? Does your shortcut key include the shift key? If yes, then remove the shiftkey from the shortcut key combination. Holding the shift key while opening a workbook stops the open macros (workbook_open/auto_open) from running. And it can confuse excel enough so that it doesn't know to continue with the remainder of your original code. This is a problem with xl2003 (and below). I don't use xl2007 to know for sure. If this doesn't help, I think you'll have to give more info. wrote: 2003 & 2007 What could cause a macro fine run fine from "Select Run" but not from KB Shortcut? Just in case, I changed the KB Shortcut but still the issue. BTW same result on different computers. Any thoughts appreciated! EagleOne -- Dave Peterson |
Macro fine Run fine from Select but not from KB Shortcut?
(Gary's Student) Since I have switched keys that should not be the issue.
Thanks for our thoughts Hello Dave, Does your code open another workbook and fail right after it opens that workbook? YES Does your shortcut key include the shift key? YES Got your thoughts on the "Shift" key. What is the issue "open another workbook?" In fact, the macro opens a text file using an array which is ultimately Saved As .xls EagleOne Dave Peterson wrote: Does your code open another workbook and fail right after it opens that workbook? Does your shortcut key include the shift key? |
Macro fine Run fine from Select but not from KB Shortcut?
Just for devilment,
If I wanted to, how would I use (do I need to) ReDim or ReDim Preserve to "clear" the array from memory with the array next? Workbooks.OpenText FileName:="C:\Hold\Directory Listing.txt", _ Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:= _ Array(Array(0, 1), Array(10, 1), Array(11, 1), thru Array(39, 1)) EagleOne Dave Peterson wrote: Does your code open another workbook and fail right after it opens that workbook? Does your shortcut key include the shift key? If yes, then remove the shiftkey from the shortcut key combination. Holding the shift key while opening a workbook stops the open macros (workbook_open/auto_open) from running. And it can confuse excel enough so that it doesn't know to continue with the remainder of your original code. This is a problem with xl2003 (and below). I don't use xl2007 to know for sure. If this doesn't help, I think you'll have to give more info. wrote: 2003 & 2007 What could cause a macro fine run fine from "Select Run" but not from KB Shortcut? Just in case, I changed the KB Shortcut but still the issue. BTW same result on different computers. Any thoughts appreciated! EagleOne |
Macro fine Run fine from Select but not from KB Shortcut?
Dave,
The Shortcut w/o the shift key worked. Only if you have time (silly me) I would like to know about why the "open file" issue. Thanks Dave Peterson wrote: Does your code open another workbook and fail right after it opens that workbook? Does your shortcut key include the shift key? If yes, then remove the shiftkey from the shortcut key combination. Holding the shift key while opening a workbook stops the open macros (workbook_open/auto_open) from running. And it can confuse excel enough so that it doesn't know to continue with the remainder of your original code. This is a problem with xl2003 (and below). I don't use xl2007 to know for sure. If this doesn't help, I think you'll have to give more info. wrote: 2003 & 2007 What could cause a macro fine run fine from "Select Run" but not from KB Shortcut? Just in case, I changed the KB Shortcut but still the issue. BTW same result on different computers. Any thoughts appreciated! EagleOne |
Macro fine Run fine from Select but not from KB Shortcut?
Nope. You don't need to clear that array of arrays.
Just specify the new one. But if you ever want to empty an array variable that you used, you can erase it. Dim myArray(1 to 3) as long myarray(1) = 99 myarray(2) = 3 myarray(3) = -43 erase myarray But your code doesn't even use a variable to hold the array. It's kind of like hardcoding the value into a comparison: Dim myVal as string myval = "something" if myval = "ok" then .... compared to: dim myVal as string dim myOtherVal as string myval = "onething" myotherval = "anotherthing" if myval = myotherval then .... in that case, you may want to clear that variable. myotherval = "" (similar in function to erase myArray) wrote: Just for devilment, If I wanted to, how would I use (do I need to) ReDim or ReDim Preserve to "clear" the array from memory with the array next? Workbooks.OpenText FileName:="C:\Hold\Directory Listing.txt", _ Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:= _ Array(Array(0, 1), Array(10, 1), Array(11, 1), thru Array(39, 1)) EagleOne Dave Peterson wrote: Does your code open another workbook and fail right after it opens that workbook? Does your shortcut key include the shift key? If yes, then remove the shiftkey from the shortcut key combination. Holding the shift key while opening a workbook stops the open macros (workbook_open/auto_open) from running. And it can confuse excel enough so that it doesn't know to continue with the remainder of your original code. This is a problem with xl2003 (and below). I don't use xl2007 to know for sure. If this doesn't help, I think you'll have to give more info. wrote: 2003 & 2007 What could cause a macro fine run fine from "Select Run" but not from KB Shortcut? Just in case, I changed the KB Shortcut but still the issue. BTW same result on different computers. Any thoughts appreciated! EagleOne -- Dave Peterson |
Macro fine Run fine from Select but not from KB Shortcut?
|
All times are GMT +1. The time now is 03:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com