FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Strange issue: Excel
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Strange issue: Excel
Posted: Mon Dec 28, 2020 09:33 PM
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 (fw): Select all Collapse
   // 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: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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 1515
Joined: Thu Oct 30, 2008 02:37 PM
Re: Strange issue: Excel
Posted: Mon Dec 28, 2020 10:27 PM
Hi,

A similar (old) problem

https://groups.google.com/g/harbour-dev ... jUKKfNBAAJ


A workaround is:

Code (fw): Select all Collapse
   // 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
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Strange issue: Excel
Posted: Tue Dec 29, 2020 11:16 PM

Thanks ... that appears to have resolved it for now ...

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Strange issue: Excel
Posted: Sat Jan 02, 2021 11:53 PM

And yet it did not. It worked temporarily then failed again.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Strange issue: Excel
Posted: Mon Jan 04, 2021 08:11 PM
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:Name := "Arial"
oAS:Size := 12
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Strange issue: Excel
Posted: Mon Jan 04, 2021 09:31 PM
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 (fw): Select all Collapse
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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Strange issue: Excel
Posted: Tue Jan 05, 2021 12:07 AM

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
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit

Continue the discussion