Hi,
I make one report to export Item Inventory and Consumption to Excel. It shoud be enter in one Workbook, one File but two different Worksheet.
I've tried many ways but it always created 2 Files ](*,)
Can you help me?
Thanks.
Here is my code:
My Report:
Function ExportInventory()
TempExcelBuffer.DELETEALL;
CLEAR(TempExcelBuffer);
EnterCell(....)
TempExcelBuffer.CreateBook;
TempExcelBuffer.CreateSheet('Inv','',COMPANYNAME,USERID);
Function ExportConsumption()
TempExcelBuffer.DELETEALL;
CLEAR(TempExcelBuffer);
EnterCell(....)
TempExcelBuffer.CreateBook;
TempExcelBuffer.CreateSheet('Inv','',COMPANYNAME,USERID);
If I don't use Createbook in my second function, it would cause an Error 'No instanz bla bla'
I guess I should create a new function 'CreateNewSheet' in Table Excel Buffer, but how?
Comments
Here is my solution :
1.
In Table 370, I add new function CreateSheet2(..) the same CreateSheet() function but at the beginning of it, I add some additional code as follow :
CreateSheet2(..)
IF NewSheetNb <> 0 THEN BEGIN
XlWorkSheet := XlWorkBook.Worksheets.Item(NewSheetNb);
XlWorkSheet.Activate;
END;
…
2.
Export the first one :
…..
ExcelBufTemp.CreateBook;
ExcelBufTemp.CreateSheet2(
'Inventory',
'1',
COMPANYNAME,USERID,
0);
3.
Export the second one :
….
ExcelBufTemp.CreateSheet2(
'Consumption',
'2',
COMPANYNAME,USERID,
2);
ExcelBufTemp.GiveUserControl;
Hope your report run well.
If you find out the better way please tell me.
Regard.
Thanks for your help.
But nothing changed, I still received the same error messages:
If I put the code before the second Exportcommand than it works... but this is not what I want..
Do you still have another idea?
[-o<
Could you tell me more detail than what you do ?
Ok, I will show you what have I done.
And in Table 370 Excel Buffer I have added several new function.
To add a new Worksheet in the same Workbook I have tried your ways:
You can try as follow :
- Don't use this command CLEAR(TempExcelBuffer) in the second export function ExportHistory()
(because when you clear you can not keep the sheet)
- Don't name Sheet as "History" because error :
"The message is for C/AL progrmaers :
The call to member Name failed. Microsoft Excel returned the following message :
History is reserved name."
- And try create book and sheet as I try as below code
ExportInventory()
{
.....
.....
TempExcelBuffer.CreateBook;
TempExcelBuffer.CreateNewSheet('Inventory','1',COMPANYNAME,USERID,0);
}
ExportHistory()
{
...
//CLEAR(TempExcelBuffer);
...
TempExcelBuffer.CreateNewSheet('Consumption','2',COMPANYNAME,USERID,2);
TempExcelBuffer.GiveUserControl();
}
I will try rite now.. =P~
Thanks Lynhthy!!!! =D>
Cám ón ông
Got it from google..
Vietnamese (Vietnam) Cám ón
Vietnamese (Vietnam) [to man] Cám ón ông
Vietnamese (Vietnam) [to married woman] Cám ón bà
Vietnamese (Vietnam) [to unmarried woman] Cám ón cô
Vietnamese (Vietnam) [to male equal] Cám ón anh
Vietnamese (Vietnam) [to female equal] Cám ón chi
Vietnamese (Vietnam) [to young person] Cám ón em
Vietnamese (Vietnam) Cám òn qúi vi rhât
Vietnamese (Vietnam) Ông quá tú-tê dôí vói tôi
So many variation.. hmm.. Ups... this is not Grammarforum..
By the way.. I like pho ... vietnamese noodle.. nyam...
Cám ón chi