Instantiating an Excel Object from Peoplesoft page
Forum » Forum / Help » Instantiating an Excel Object from Peoplesoft page
Started by: Susan (guest)
On: 1248825207|%e %b %Y, %H:%M %Z|agohover
Number of posts: 8
rss icon RSS: New posts
Summary:
Error on ObjectGetProperty statement
Instantiating an Excel Object from Peoplesoft page
Susan (guest) 1248825207|%e %b %Y, %H:%M %Z|agohover

Using the example from PeopleBooks returns an error on the ObjectGetProperty statement and I don't know what is wrong with it.
The code used is as follows:

Local object &WorkApp, &WorkBook;

&WorkApp = CreateObject ("COM", "Excel.Application");
&WorkBook = ObjectGetProperty(&WorkApp, "Workbooks");

etc
The message returned for the ObjectGetProperty statement says "Invalid parameter: CreateObject Excel.Application invalid class string for function ObjectGetProperty. The specified parameter is not correct for the function. It may be the wrong type of parameter (string, number, record, field etc) or an invalid value in this context.

Can anyone help?

Reply  |  Options
Unfold Instantiating an Excel Object from Peoplesoft page by Susan (guest), 1248825207|%e %b %Y, %H:%M %Z|agohover
Re: Instantiating an Excel Object from Peoplesoft page
PrajPraj 1248866699|%e %b %Y, %H:%M %Z|agohover

Should the variable &WorkBook be delcared as an object? If you change the delcaration line to:

Local object &WorkApp;

And remove, &WorkBook, does that make any difference?

Last edited on 1248867078|%e %b %Y, %H:%M %Z|agohover By Praj + Show more
Reply  |  Options
Unfold Re: Instantiating an Excel Object from Peoplesoft page by PrajPraj, 1248866699|%e %b %Y, %H:%M %Z|agohover
Re: Instantiating an Excel Object from Peoplesoft page
Valkyrie (guest) 1249065239|%e %b %Y, %H:%M %Z|agohover

Yes its should be declare as Object when instantiating workbook, worksheet, range or cell objects in Excel heres my declaration and it works fine;

Local object &oWorkApp, &oWorkSheet, &oWorkBook, &oRange, &oCells;

Valkyrie

Reply  |  Options
Unfold Re: Instantiating an Excel Object from Peoplesoft page by Valkyrie (guest), 1249065239|%e %b %Y, %H:%M %Z|agohover
Re: Instantiating an Excel Object from Peoplesoft page
Valkyrie (guest) 1249064977|%e %b %Y, %H:%M %Z|agohover

Hi Susan, I use the same code and it works fine. Only thing I notice in your code is that you have space between createObject and the parenthesis

Heres our code compare side by side
&WorkApp = CreateObject ("COM", "Excel.Application"); your code
&oWorkApp = CreateObject("COM", "Excel.Application"); my code

&oWorkBook = ObjectGetProperty(&oWorkApp, "Workbooks"); my coode
&WorkBook = ObjectGetProperty(&WorkApp, "Workbooks"); your code

I hope it helps..

Valkyrie

Reply  |  Options
Unfold Re: Instantiating an Excel Object from Peoplesoft page by Valkyrie (guest), 1249064977|%e %b %Y, %H:%M %Z|agohover
Re: Instantiating an Excel Object from Peoplesoft page
Anisha (guest) 1268073675|%e %b %Y, %H:%M %Z|agohover

Hello Susan,

Are you still having the same error "Invalid parameter: CreateObject Excel.Application invalid class string for function ObjectGetProperty." ? What have you done to correct this error?
I am actually facing the same error when using the following code in my AE peoplecode:
Local object &oWorkApp,&oWorkBook;
&oWorkApp = CreateObject("COM", "Excel.Application");
&oWorkBook = ObjectGetProperty(&oWorkApp, "Workbooks");

Thank you for your help.

Reply  |  Options
Unfold Re: Instantiating an Excel Object from Peoplesoft page by Anisha (guest), 1268073675|%e %b %Y, %H:%M %Z|agohover
Manipulating Excel Object in PeopleCode
Valkyrie (guest) 1249064593|%e %b %Y, %H:%M %Z|agohover

Hi,

I have instantiated Excel Object in AE Peoplecode and have been successfully manipulating data cells in each worksheet tab of my workbook.
Now I want to copy a range of cells from one worksheet to another and paste its values on the other worksheet, though I dont encounter error but the
action does not execute. Also when I try to save the excel file it takes forever to save. Heres some part of my code
Appreciate your input.

get a cell range then;

&RangeSelected = &oCells.Copy;
&oWorkSheet1 = &oWorkApp.Worksheets("Sheet2");
&oCell = ObjectGetProperty(&oWorkSheet1, "Range", "A1");
&SheetSelected = &oWorkSheet1.Activate;
&oCell = ObjectGetProperty(&oCell, "PasteSpecial");

ObjectDoMethod(&WORKAPP, "Save", "C:\TEMP\TEST1.XLS");

Thanks a lot

Valkyrie

Reply  |  Options
Unfold Manipulating Excel Object in PeopleCode by Valkyrie (guest), 1249064593|%e %b %Y, %H:%M %Z|agohover
Re: Manipulating Excel Object in PeopleCode
Tom (guest) 1264089502|%e %b %Y, %H:%M %Z|agohover

Hi - I have sqr process to read the .dat file as input file. But I am getting the file in excel format. I want to convert this XLS file into .dat format. I am unable to do this through the SQR. One of my colleague suggest me go with the Application Engine. Here is the code I am trying to convert the XLS file into .DAT through the App Engine. But I am missing the link between after opening the xls file and writing into .DAT file. Can you help me how to connect between after opening the file and writing the file.

&oWorkApp = CreateObject("COM", "Excel.Application");
ObjectSetProperty(&oWorkApp, "Visible", True);
&oWorkBook = ObjectGetProperty(&oWorkApp, "Workbooks");
&oWorkBook.Open("C:\temp\rates99.xls");

Local File &DATFILE;
Local string &FILE_NAME, &DATA;

&FILE_NAME = "C:\temp\rates.dat";
&DATFILE = GetFile(&FILE_NAME, "r");
&FileName = &DATFILE.Name;
&POS = Find(".", &FileName);
&NEWFILE_NAME = Substring(&FileName, 1, &POS) | "dat";
&DATFILE = GetFile(&NEWFILE_NAME, "N", %FilePath_Absolute);
If &DATFILE.IsOpen Then
While &DATFILE.ReadLine(&DATA);
&DATFILE.WriteLine(&DATA);
End-While;
&DATFILE.Close();
End-If;

Reply  |  Options
Unfold Re: Manipulating Excel Object in PeopleCode by Tom (guest), 1264089502|%e %b %Y, %H:%M %Z|agohover
Re: Manipulating Excel Object in PeopleCode
hfjf (guest) 1268231177|%e %b %Y, %H:%M %Z|agohover

http://peoplesoft.wikidot.com/generating-a-csv-file-from-sqr

Reply  |  Options
Unfold Re: Manipulating Excel Object in PeopleCode by hfjf (guest), 1268231177|%e %b %Y, %H:%M %Z|agohover
New Post
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License