Bryan Carbonnell
carbonnb at sympatico.ca
Sat Jan 21 12:46:27 CST 2006
On 21 Jan 2006 at 13:40, John Colby wrote: > This does assume a reference to Excel however. I am attempting to make my > code run with the reference (use early binding if available) or not (use > late binding). I am very meticulously using > > #Const EarlyBind = True > #If EarlyBind Then > Private mxlApp As excel.Application > Private mxlBook As Workbook > Private mxlSheet As Worksheet > #Else > Private mxlApp As Object > Private mxlBook As Object > Private mxlSheet As Object > #End If > > Etc. > > dim wbkNew as Excel.Workbook > > Will fail when EarlyBind is false (no reference to the excel lib is > available) True the dim will fail with late binding, but you can still do the variable assignment. (using your variables listed above) dim wbkNew as Object .... set wbkNew = mxlApp.Workbooks.Add -- Bryan Carbonnell - carbonnb at sympatico.ca Needing someone is like needing a parachute. If he isn't there the first time, chances are you won't be needing him again.