Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel 2010 Automation issue with workbook object
Message
From
10/12/2013 07:37:47
 
 
To
10/12/2013 06:34:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01589653
Message ID:
01589657
Views:
55
>I have a small Excel automation program that generates a data set in VFP and then copies the data to an Excel spreadsheet. I than create a workbook object and add a chart to it.
>
>COPY TO C:\myfolder\mysheet.XLS TYPE XLS
>oWorkBook = GETOBJECT("C:\myfolder\mysheet.xls")
>oChart1=oWorkBook.Charts.Add()	
>
>This works fine in Excel 2003 (on XP) but crashes in Excel 2010 (on a W7 OS) on the 3rd line with Error message: Object OWORKBOOK is not found.
>
>Any help appreciated.
>
>Barry Sutton

I do the following:
LOCAL loExcel AS Excel.Application
LOCAL loWorkbook AS Excel.Workbook
LOCAL loWorksheet AS Excel.Worksheet
*
loExcel = CREATEOBJECT("Excel.Application")
loWorkbook = loExcel.Workbooks.Open("C:\myfolder\mysheet.xls")
loWorksheet = loWorkbook.ActiveSheet
*
loWorkbook.Charts.Add()
*
loWorkbook.Save()
*
loExcel.Visible = .T.
Christian Isberner
Software Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform