Thread
:
Macro fine Run fine from Select but not from KB Shortcut?
View Single Post
#
8
Posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
Posts: 35,218
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
Reply With Quote
Dave Peterson
View Public Profile
Find all posts by Dave Peterson