Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Automation: What's wrong with my code?

Status
Not open for further replies.

ganj

IS-IT--Management
Nov 3, 2001
19
AT
I am getting the following error in a form method that creates an Excel worksheet from an underlying VFP cursor:

Error #1429 in Outputexcel
....
OLE IDispatch exception code 0 from Microsoft Excel: Unable to set the PrinTitleRows property of the PageSetup class ..
...

The piece of code in question:

WITH oActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
ENDWITH

Strange enough, this code produces no problem since about a year. Now the customer upgraded to Win2K with Office 2000 (SP1) and suddently I have this thing....

Can anybody enlighten me what's wrong with my code?
 
ganj

WITH oActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
ENDWITH


Can you explain what the code is suppose to do? I tried your code on Win98 (Excel 2002), and I don't get an error, but it doesn't seem to do much either.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

this code is preceeded by other code, basically creating the excel object, pasting data from the cursor, etc.
The final step is apply some formatting, and this is where the bug strikes.

tia, JoGa
 
ganj

I'm not sure, but can you determine which of the two lines causes the problem? I would suspect it's:
.PrintTitleRows = "$1:$1"

Since its not the regular way to refer to a Row/column in automation.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hej !
It's line from my program:
Ex.ActiveSheet.PageSetup.PrintTitleRows = "$5:$5" Kind regards from Warsaw !!!!!
Monika (monikai@yahoo.com)
 
@Mike:

The line causing the problem is:

.PrintTitleRows = "$1:$1"

What do you mean, "it's not the regular way to refer to a Row/column in automation."? This could be the solution!

tia,
 
GANJ

I just notice in the MSDN for Excel that the format should be A1 style.
Returns or sets the rows that contain the cells to be repeated at the top of each page, as a string in A1-style notation in the language of the macro. Read/write String.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top