🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13850

Create Excel document

#13850
From: Gunter Gemmel
Date: Thu, 18 Sep 2003 08:02
28 lines
1752 bytes
    I tried to create an Excel document:

MyExcel = Variant::CreateObject("excel.application");

    Variant AllWorkbooks, MyWorkbook, MyWorksheet, MyRange;

    AllWorkbooks = MyExcel.OlePropertyGet("Workbooks");
    MyExcel.OlePropertySet("SheetsInNewWorkbook", (Variant)1);
    MyWorkbook = AllWorkbooks.OleFunction("Add");

    MyWorksheet = MyWorkbook.OlePropertyGet("ActiveSheet");

    PropertyGet Range("Range");
    PropertySet SetValue("Value");

    Range.ClearArgs();
    SetValue.ClearArgs();

    MyRange = MyWorksheet.Exec(Range << "A1");
    MyRange.Exec(SetValue << "Auswertungen");

    Procedure SaveAs("SaveAs");
    MyWorkbook.Exec(SaveAs << "C:\\Test.xls");

But my application interupts with "Can not access to C:\Test.xls".

Whats wrong?
    Thanks Gunter
Technical Details
Message-ID: <3f69667d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,ffa35bf9538d0ffc,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-18 01:20:58 PST
From: "Gunter Gemmel" <info@gungem.de>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Create Excel document
Date: Thu, 18 Sep 2003 10:02:05 +0200
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 217.232.253.136
Message-ID: <3f69667d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1063872125 217.232.253.136 (18 Sep 2003 01:02:05 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail