Question about FWH and Excel

Post Reply
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Question about FWH and Excel

Post by driessen »

Hello,

Can someone tell me how I can change a backgroundcolor of a field in an Excel file from my FWH-application?

Thank you.
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
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Question about FWH and Excel

Post by ADutheil »

Try this
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( 1, 7 ) ):Interior:ColorIndex := Violeta
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about FWH and Excel

Post by driessen »

Thanks for your suggestion.

Where do I find the information how to build such FWH-code to control Excel?

Can I use RGB-codes?
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
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Question about FWH and Excel

Post by ADutheil »

Anytime I need something new I search Excel VBA examples and adapt them to FWH. As for RGB colors I don't know. Check below.

https://www.automateexcel.com/excel-for ... lor-index/
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about FWH and Excel

Post by driessen »

And how do you adapt vrom VBA to FWH?
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
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Question about FWH and Excel

Post by ADutheil »

I don't have a recipe but there are a lot of similarities: VAB Cells(x, y).Interior.ColorIndex <-> FWH Cells(x, y):Interior:ColorIndex.
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about FWH and Excel

Post by driessen »

And please, can you tell me how to add a sheet in an Excel-document?
And can you tell me how to change the name of the sheet?
Thanks.
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
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Question about FWH and Excel

Post by ADutheil »

Code: Select all

oExcel := win_oleCreateObject( "Excel.Application" )
oWorkb := oExcel:WorkBooks:Add()
oSheet := oWorkb:Sheets( number of the sheet you want to work with 1 2 3... )
oSheet:Name := "the name you want for your sheet"
 
PM me your mail I'll send you a code you can use to learn more about VBA methods and properties.
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: Question about FWH and Excel

Post by hua »

FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about FWH and Excel

Post by driessen »

Thank you all very much.
I found a answer to all my question, thanks to your help.
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
Post Reply