Thread: Excel and VB6
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Excel and VB6

Yes it would, this is part of the principle of late binding, where you don't
have access to the type library information. The compiler will just
translate that variable to its value and use that, so you can just as
validly use the value directly.

If Phil hasn't set a reference to the Excel library, he is per se late
binding, so he won't have access to any of the Excel constants, just the VB
constants.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Peter T" <peter_t@discussions wrote in message
...
Hi Bob,

Again I ask, have you set a reference to Excel in the VB project. If you
haven't, and you don't have Option Explicit at the start of the code, it
will run until it gets to that line then bomb out as there will be no

value
associated with xlLeft (VB does not have an xlLeft constant).


For my interest, would it (and similar) work with xlLeft as a value:

With xlWs.Cells
.HorizontalAlignment = -4131 ' xlLeft
End With

Regards,
Peter