#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Automation

I am opening an instance of Excel 2007 from Access 2007

Set xlAPP = CreateObject("Excel.Application")
Set xlBook = xlAPP.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)

Unfortunately the Set xlBook = xlAPP.Workbooks.Add causes our
document management software to ewrror.

My guess is that the "Add" method somehow by passes the DM code that
would have been run had the workbook been opened.

I cannot trap the error - [object referenced without first being set]
as its not ocurring in my code

Can I use an "Open" method instead of "Add" to open a default new
workbook without the workbook existing or would I have to create the
workbook first.

As a workaround I have created an empty .xlt and use the open method
- this is not ideal as it creates a dependency on the empty file

Any thoght appreciated

Cheers

Kieran

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Automation

Instead of:

Set xlBook = xlAPP.Workbooks.Add

Try:

xlAPP.Workbooks.Add



"Kieran H" wrote:

I am opening an instance of Excel 2007 from Access 2007

Set xlAPP = CreateObject("Excel.Application")
Set xlBook = xlAPP.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)

Unfortunately the Set xlBook = xlAPP.Workbooks.Add causes our
document management software to ewrror.

My guess is that the "Add" method somehow by passes the DM code that
would have been run had the workbook been opened.

I cannot trap the error - [object referenced without first being set]
as its not ocurring in my code

Can I use an "Open" method instead of "Add" to open a default new
workbook without the workbook existing or would I have to create the
workbook first.

As a workaround I have created an empty .xlt and use the open method
- this is not ideal as it creates a dependency on the empty file

Any thoght appreciated

Cheers

Kieran


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Supressing the ctrl-c and other keys during word automation in automation apondu Excel Programming 0 July 19th 07 10:10 PM
Automation Allenc Excel Worksheet Functions 5 January 13th 07 10:42 AM
automation Darius New Users to Excel 1 September 23rd 05 07:37 AM
Automation Chris Excel Programming 1 March 8th 05 06:45 PM
Automation Tom Excel Programming 3 December 31st 03 08:51 AM


All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"