View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default Querytables parameters


"Jamie Collins" wrote in message
oups.com...

Dick Kusleika wrote:
Both the QueryTable object and the Parameter
object are objects in the Excel object library. You could say this

Dim param1 As Excel.Parameter

but it's totally unnecessary.


'Optional' could be a better way of putting it <g.


No doubt. I've always assumed that Excel had a higher precedence than
anything else, but I probably shouldn't.

By omitting the library name you are making an assumption, in this case
that a reference to Excel has been set and that it has a higher
precedence than any other referenced library with a Parameter class
e.g. ADODB. I wager that, in contrast, for variables of type
ADODB.Recordset you *always* include the library name, yet how often do
you reference another library with a Recordset class? Convention has a
lot to answer for.


You'd win that wager. I never thought about it, but I'll bet I reference
other libraries with Recordset and have just gotten lucky in the order.


I often use Excel.<class in code for which I think it may get some
future re-use in a non-Excel project.


That's one I've never considered. My apps would be a heck of a lot harder
to port to, say, VB6.

--
Dick Kusleika
MVP Excel
Daily Dose of Excel
http://www.dicks-blog.com