Strange issue: Excel

Post Reply
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Strange issue: Excel

Post 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.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: Strange issue: Excel

Post 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
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Strange issue: Excel

Post by TimStone »

Thanks ... that appears to have resolved it for now ...
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Strange issue: Excel

Post by TimStone »

And yet it did not. It worked temporarily then failed again.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: Strange issue: Excel

Post 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
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Strange issue: Excel

Post 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;
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Re: Strange issue: Excel

Post 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.
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
Post Reply