Excel problem (ActiveX)

forum.advanced.programming (1998-2005)
Philipp Druyts

Excel problem (ActiveX)

Post by Philipp Druyts » 28 Feb 2005, 10:19

 Posted by:  Philipp Druyts 

Hi all,

Does anyone know what this error is about ?
It's generated when calling this piece of code:
If NOT SalActiveXGetActiveObject( cfnExcelApp, "Excel.Application.8" )
If NOT cfnExcelApp.Create('Excel.Application.8')
Call cfnExcelApp.ErrorProc( 'OnOpen.App.Create' ) !<-- this generates the
error
Return FALSE

TIA.

Philipp

Attachment: 1.JPG

Stefan Beltrame

Excel problem (ActiveX)

Post by Stefan Beltrame » 28 Feb 2005, 13:37

 Posted by:  Stefan Beltrame 

Maybe you do not have Excel Version 8 installed.
Try 'Excel.Application' and it will use the installed version.

Regards
Stefan

Philipp Druyts

Excel problem (ActiveX)

Post by Philipp Druyts » 01 Mar 2005, 09:14

 Posted by:  Philipp Druyts 


Thanks !!!
This works, but it brings another problem:
Call cfnExcel.cfnExcelWorksheet.SaveAs(sDirExcel ||
sFileName,FileFormat,Password,WriteResPassword,ReadOnlyRecommended,CreateBackup,AddToMru,TextCodepage,TextVisualLayout,Local)
doesn't work anymore ... I don't know what all the variants need to contain,
earlier it were other parameters.

Parameters
String: Filename
: FileFormat
Class: Variant
: Password
Class: Variant
: WriteResPassword
Class: Variant
: ReadOnlyRecommended
Class: Variant
: CreateBackup
Class: Variant
: AddToMru
Class: Variant
: TextCodepage
Class: Variant
: TextVisualLayout
Class: Variant
: Local
Class: Variant

I looked at MSDN but didn't get any wiser.
Does anyone have an example?

TIA

Philipp

Stefan Beltrame

Excel problem (ActiveX)

Post by Stefan Beltrame » 01 Mar 2005, 10:34

 Posted by:  Stefan Beltrame 

Hi Philipp

I do not know what's the last parameter (Local) is for. But you can set the
unused parameters to optional.

Variant: varUnused

Call varUnused.MakeOptional()
call cfnExcel.cfnExcelWorksheet.SaveAs(sDirExcel || sFileName, varUnused,
varUnused, ...)

Regards
Stefan

P.S. Did you ever try to rebuild the Excel AXLib APL?

sFileName,FileFormat,Password,WriteResPassword,ReadOnlyRecommended,CreateBac
kup,AddToMru,TextCodepage,TextVisualLayout,Local)

Philipp Druyts

Excel problem (ActiveX)

Post by Philipp Druyts » 01 Mar 2005, 11:17

 Posted by:  Philipp Druyts 


The first solution you give doesn't work ... so I'm trying the rebuilt Excel
AXLib ... I'll keep you posted.

Philipp

Philipp Druyts

Excel problem (ActiveX)

Post by Philipp Druyts » 01 Mar 2005, 16:33

 Posted by:  Philipp Druyts 


I rebuilt the AXLib, but when I call
cfnExcelWorkbooks.Open(p_sFile,Parameter,Parameter2,Parameter3,Parameter4,Parameter5,Parameter6,Parameter7,
Parameter8,Parameter9,Parameter10,Parameter11,Parameter12,
cfnExcelWorkbook )
it always fails ... with parameters unused or even when I initialize the
parameters like this:
Call Parameter.SetBoolean(FALSE)
Call Parameter2.SetBoolean(FALSE)
Call Parameter3.SetNumber(xlWorksheet, VT_I4)
Call Parameter4.SetString('')
Call Parameter5.SetBoolean(FALSE)
Call Parameter6.SetBoolean(TRUE)
Call Parameter7.SetString('')
Call Parameter8.SetString('')
Call Parameter9.SetBoolean(TRUE)
Call Parameter10.SetBoolean(FALSE)
Call Parameter11.SetBoolean(FALSE)
Call Parameter12.SetBoolean(FALSE)

cfnExcelWorkbooks is derived from Excel_Workbooks.

TD version 1.5.1, office 2000, windows XP SP2.

Anyone have any suggestion please ? I'm at a loss ...

TIA.

Philipp

Dmitry

Excel problem (ActiveX)

Post by Dmitry » 02 Mar 2005, 07:12

 Posted by:  Dmitry 

Hi Philipp!

!!CB!! 129
Call exApplication.PropGetWorkbooks( exWorkbooks )
Call UpdateLinks.MakeOptional( )
Call ReadOnly.MakeOptional( )
Call Format.MakeOptional( )
Call Password.MakeOptional( )
Call WriteResPassword.MakeOptional( )
Call IgnoreReadOnlyRecommended.MakeOptional( )
Call Origin.MakeOptional( )
Call Delimiter.MakeOptional( )
Call Editable.MakeOptional( )
Call Notify.MakeOptional( )
Call Converter.MakeOptional( )
Call AddToMru.MakeOptional( )
If exWorkbooks.Open( p_sFileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword,
IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter,
AddToMru, exWorkbook )

or

Call Variant.MakeOptional( )
If exWorkbooks.Open( p_sFileName, Variant, Variant, Variant, Variant,
Variant,
Variant, Variant, Variant, Variant, Variant, Variant, Variant,
exWorkbook )

Philipp Druyts

Excel problem (ActiveX)

Post by Philipp Druyts » 02 Mar 2005, 08:53

 Posted by:  Philipp Druyts 

Big thanks !!
This is what I needed !!!

Thanks for all your help !

Philipp

Return to “advanced.programming”

Who is online

Users browsing this forum: [Ccbot] and 0 guests