Strange issue: Excel

Strange issue: Excel

Postby TimStone » Mon Dec 28, 2020 9: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: Select all  Expand view

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

Re: Strange issue: Excel

Postby hmpaquito » Mon Dec 28, 2020 10:27 pm

Hi,

A similar (old) problem

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


A workaround is:

Code: Select all  Expand view
  // 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
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Strange issue: Excel

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

Re: Strange issue: Excel

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

Re: Strange issue: Excel

Postby Gale FORd » Mon Jan 04, 2021 8: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:Cells:Font:Name := "Arial"
oAS:Cells:Font:Size := 12
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Strange issue: Excel

Postby driessen » Mon Jan 04, 2021 9: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: Select all  Expand view
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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Strange issue: Excel

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 19 guests

cron