John Colby
jwcolby at ColbyConsulting.com
Sat Jan 21 12:40:02 CST 2006
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) John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell Sent: Saturday, January 21, 2006 12:24 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] New excel workbooks On 21 Jan 2006 at 18:10, Gustav Brock wrote: > Hi John > > Workbooks.Add > > A new workbook gets the id equal to the count of workbooks. > > lngWorkbooks = Workbooks.Count > strWorkbookNewName = Workbooks.Item(lngWorkbooks).Name > > That's a default localized name like "Book2" etc. until you save it. You could set a workbook variable to the new workbook when you create it. dim wbkNew as Excel.Workbook wbkNew = Workbooks.Add -- Bryan Carbonnell - carbonnb at sympatico.ca Never test for a bug you don't know how to fix. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com