I am using Visual Basic 6 SP6, Windows XP Pro and Excel 97. I have a predefined workbook in which there is a predefined worksheet and predefined Chart.
I have bound Excel in my startup module so that is not a problem. The following is my code:
Dim wSheet as Excel.Worksheet
Dim wChart as Excel.Chart
Set wBook = ObjExcel.WorkBooks.Open("WorkSheetName")
Set wSheet = ObjExcel.Sheets(1)
Set wChart = ObjExcel.Charts(1)
I now click a Command button which executes the following code:
The Chart prints to the printer without a problem but when I try and execute the following code:
The application just hangs. When I cancel Excel my error handler displays the following message:
-2147023170 Automation Error The Remote Procedure Call Failed.
Any idea what could be wrong ?.