Page 1 of 1
Strange issue: Excel
Posted: Mon Dec 28, 2020 9:33 pm
by TimStone
This is a strange one to me. It started occuring recently. It's consistent here, but not in all functions where this is used:
Code: Select all
// Create the object
oExcel := ExcelObj( )
oExcel:WorkBooks:Add( )
oAS := oExcel:ActiveSheet( )
oAS:Cells:Font:Name := "Arial"
oAS:Cells:Font:Size := 12
And this is generating the following error in the line that sets the font oAS:Celss:Font:Name := "Arial"
Error description: Error BASE/1005 No exported variable: NAME
Args:
[ 1] = A { ... } length: 2
[ 2] = C Arial
Any ideas ? In other XLS exports the same code is sorking fine.
Re: Strange issue: Excel
Posted: Mon Dec 28, 2020 10:27 pm
by hmpaquito
Hi,
A similar (old) problem
https://groups.google.com/g/harbour-dev ... jUKKfNBAAJ
A workaround is:
Code: Select all
// Create the object
oExcel := ExcelObj( )
oExcel:WorkBooks:Add( )
oAS := oExcel:ActiveSheet( )
FOR i:= 1 TO 5
BEGIN SEQUENCE
oAS:Cells:Font:Name := "Arial"
EXIT
END
NEXT
oAS:Cells:Font:Size := 12
Re: Strange issue: Excel
Posted: Tue Dec 29, 2020 11:16 pm
by TimStone
Thanks ... that appears to have resolved it for now ...
Re: Strange issue: Excel
Posted: Sat Jan 02, 2021 11:53 pm
by TimStone
And yet it did not. It worked temporarily then failed again.
Re: Strange issue: Excel
Posted: Mon Jan 04, 2021 8:11 pm
by Gale FORd
Maybe try making Excel visible to see if it has problems.
// Create the object
oExcel := ExcelObj( )
oExcel:Visible := .t.
oExcel:WorkBooks:Add( )
oAS := oExcel:ActiveSheet( )
oAS:Cells:Font:Name := "Arial"
oAS:Cells:Font:Size := 12
Re: Strange issue: Excel
Posted: Mon Jan 04, 2021 9:31 pm
by driessen
Tim,
I have noticed the recent months that this kinds of problems often occurs after an update of office 2013 or a later version.
Repairing your Office, seems to solve it.
Maybe you can also try this :
Code: Select all
TRY
oAS:Cells:Font:Name := "Arial"
CATCH
TRY
oAS:Cells:Font:Name := "Arial"
CATCH
END
END
The font is set twice but in case of error, your application goes on without an error message.
That way I try to avoid this kind of errors;
Re: Strange issue: Excel
Posted: Tue Jan 05, 2021 12:07 am
by TimStone
Thanks for the observation. My client reported teh problem but I was able to duplicate it on my system. Also it works in some instances and not others.
We both are using Office 365, so Excel versions are the same, but different locations.