Quantcast
Channel: Instantiating an Excel Object from Peoplesoft page
Viewing all 62 articles
Browse latest View live

Instantiating an Excel Object from Peoplesoft page

$
0
0

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?


Re: Instantiating an Excel Object from Peoplesoft page

$
0
0

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?

Manipulating Excel Object in PeopleCode

$
0
0

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

Re: Instantiating an Excel Object from Peoplesoft page

$
0
0

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

Re: Instantiating an Excel Object from Peoplesoft page

$
0
0

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

Re: Manipulating Excel Object in PeopleCode

$
0
0

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;

Re: Instantiating an Excel Object from Peoplesoft page

$
0
0

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.

Re: Manipulating Excel Object in PeopleCode


(no title)

$
0
0

Hi,

I want to use this piece of code on my page on the hyperlink.

Local object &oWorkApp, &oWorkBook;
&oWorkApp = CreateObject("COM", "Excel.Application");
&oWorkApp.DisplayAlerts = "False";
&oWorkBook = ObjectGetProperty(&oWorkApp, "Workbooks");
&oWorkBook.Open("C:\some_path_to\template.xls");
&oWorkSheet = &oWorkApp.Worksheets("Sheet1");
&oWorkApp.ActiveWorkBook.SaveAs("C:\your_output_file.xls");

But when I click on the link it gives me the error 'Class COM not found. The given class is not found in the database or having problems to access it.'

Please help.

(no title)

$
0
0

Hi,

I need to create more than one sheet on excel, anyone can help me?

(no title)

$
0
0

I am facing the same issue. Can you please guide me what was done to fix this issue? for the below metioned code I m getting the following error when the AE program is run in 2 tier mode:

try
&oWorkApp = CreateObject("COM", "Excel.Application");
&oWorkApp.DisplayAlerts = "False";
&oWorkBook = ObjectGetProperty(&oWorkApp, "Workbooks");
&oWorkBook.Open("C:\temp\template.xls");
&oWorkSheet = &oWorkApp.Worksheets("Sheet1");
&oWorkApp.ActiveWorkBook.SaveAs("C:\temp\your_output_file.xls");
/* then go crazy with your worksheet object */
/* eg */
&oWorkSheet.Cells(1, 1).Value = "I'm adding stuff to be bolded";
&oWorkSheet.Cells(1, 1).Font.Bold = True;
/* Save Excel file and quit */
&oWorkApp.ActiveWorkBook.Save();
&oWorkApp.ActiveWorkBook.Close();
&oWorkApp.DisplayAlerts = "True";
&oWorkApp.Quit();
catch Exception &c1
MessageBox(0, "", 0, 0, "Caught exception: " | &c1.ToString());
end-try;

ERROR RECEIVED -
Caught exception: First operand of . is NULL, so cannot access member DisplayAlerts. (180,236)

(no title)

$
0
0

Looks like the &oWorkApp object is not being instantiated properly, has that object been declared in your code?

(no title)

$
0
0

I tried your code, and it works fine for me - for some reason it isn't picking up the Excel.Application COM object. Which version of PeopleTools are you on?

(no title)

$
0
0

When i executing Appengine i got following error

First operand of . is NULL, so cannot access member DispalyAlerts. (180,236) DS_PC_APP.MAIN.GBL.default.1900-01-01.Step02.OnExecute PCPC:188 Statement:2
Message Set Number: 180
Message Number: 236
Message Reason: First operand of . is NULL, so cannot access member %1. (180,236)

Process 1549 ABENDED at Step DS_PC_APP.MAIN.Step02 (PeopleCode) — RC = 8 (108,524)
Message Set Number: 108
Message Number: 524
Message Reason: Process 1549 ABENDED at Step DS_PC_APP.MAIN.Step02 (PeopleCode) — RC = 8 (108,524)

Process %s ABENDED at Step %s.%s.%s (Action %s) — RC = %s

(no title)

$
0
0

As per other posts, looks like the following line:

 &oWorkApp = CreateObject("COM", "Excel.Application"); 

Is not working, which PeopleTools version are you running?


(no title)

$
0
0

may be you don't have microsoft excel installed on your server that running this app engine. i got the same error, before i install the ms excel in my server. CMIIW ^^

(no title)

$
0
0

Hi,

The pre/requisite to use Excel API class is are:
1) Should be run in a windows env. Hence the batch server should be windows, in Unix these commands will not work
2) MS Excel should be installed in the windows machine. If not, then calling createobject for Excel application will throw exceptions since there is no underlying excel libraries to handle the call.

To test your AE works or not, you can try running AE in 2 tier i.e directly from Application designer assuming your work env machine is windows with excel installed. The code should work properly there.

(no title)

(no title)

$
0
0

Thanks in advance

anybody please reply to my requirements-

1)i am giving user to upload a xls file
2)then i want to populate xl file data in grid

please advice me…….

(no title)

$
0
0

Hi Dave,

Just wondering if you managed to get this working and if so, share any tips on how to do it?

Praj

Viewing all 62 articles
Browse latest View live