View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Select Excel Range from Access

since you are declaring your variables as Object, this would be an
indication that you are using late binding (not creating a reference to the
Excel object library). In that situation, xlToRight would be an undefined
variant variable (it is defined to have the value -4161 in the object
library of Excel). All constants such as these have an assigned value -
the function sees the assigned value, not the variable name xlToRight. When
you reference the object library you have included implicit code such as

Public Const xltoRight as Long = -4161

But if you use late binding then you have an implicit local declaration in
any place where you use the constant of

Variant xltoRight

If you have infact created the reference, then you can change the -4161 to
xltoright or leave it as is.

You can see the values for constants in the object browser in Excel.

--
Regards,
Tom Ogilvy

"Brian" wrote in message
...
Tom - thanks for the quick reply. I'm an admitted VBA hack, so pardon
the stupidty of this question:

From what I can tell, you've replaced the excel vba syntax of xlRight
with -4161, correct?

Are there other conventions for xlEnd, xlLeft, etc?

Many thanks,
Brian



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!