Board index » delphi » Handle Excel within Delphi

Handle Excel within Delphi

Hello

After import type library of Excel, the SaveAs procedure is like this.

    procedure SaveAs(Filename: OleVariant; FileFormat: OleVariant;
Password: OleVariant;
                     WriteResPassword: OleVariant; ReadOnlyRecommended:
OleVariant;
                     CreateBackup: OleVariant; AccessMode:
XlSaveAsAccessMode;
                     ConflictResolution: OleVariant; AddToMru:
OleVariant;
                     TextCodepage: OleVariant; TextVisualLayout:
OleVariant; lcid: Integer); safecall;

Then I try to call this procedure as the following

        xlw.SaveAs(
         filename,
         xlWorkbookNormal,
                '',

                '',

                False,
//                xlNoChange,
//                xlLocalSessionChanges,
                False,
                xlReadWrite,

                0,
                False,

                0,
                0,
                LCID);

But it goes into error!

Could I have an example of SaveAs of excel?

Thanks

pc

 

Re:Handle Excel within Delphi


xlNoChange is not Boole, it's Integer and equal to 1.

PS: you must uncomment the two lines and will be ok.

--
With best regards, Mike Shkolnik.
FIDO: 2:463/106.14
E-Mail: mshkol...@rs-ukraine.kiev.ua
        m...@woccu.freenet.kiev.ua
WEB: http://www.geocities.com/SiliconValley/Grid/3989

pc ??? a ???? <37B7E151.3C958...@ouhk.edu.hk> ...

Quote
>Hello

>After import type library of Excel, the SaveAs procedure is like this.

>    procedure SaveAs(Filename: OleVariant; FileFormat: OleVariant;
>Password: OleVariant;
>                     WriteResPassword: OleVariant; ReadOnlyRecommended:
>OleVariant;
>                     CreateBackup: OleVariant; AccessMode:
>XlSaveAsAccessMode;
>                     ConflictResolution: OleVariant; AddToMru:
>OleVariant;
>                     TextCodepage: OleVariant; TextVisualLayout:
>OleVariant; lcid: Integer); safecall;

>Then I try to call this procedure as the following

>        xlw.SaveAs(
>         filename,
>         xlWorkbookNormal,
>                '',

>                '',

>                False,
>//                xlNoChange,
>//                xlLocalSessionChanges,
>                False,
>                xlReadWrite,

>                0,
>                False,

>                0,
>                0,
>                LCID);

>But it goes into error!

>Could I have an example of SaveAs of excel?

>Thanks

>pc

Other Threads