FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Question about FWH and Excel
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Question about FWH and Excel
Posted: Thu Sep 24, 2020 09:05 AM

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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Question about FWH and Excel
Posted: Thu Sep 24, 2020 10:43 AM

Try this
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( 1, 7 ) ):Interior:ColorIndex := Violeta

Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about FWH and Excel
Posted: Thu Sep 24, 2020 10:45 AM

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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Question about FWH and Excel
Posted: Thu Sep 24, 2020 03:43 PM
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-formatting/color-reference-for-color-index/
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about FWH and Excel
Posted: Thu Sep 24, 2020 03:57 PM

And how do you adapt vrom VBA to FWH?

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: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Question about FWH and Excel
Posted: Fri Sep 25, 2020 12:55 PM

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 + MSVS 10
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about FWH and Excel
Posted: Fri Sep 25, 2020 01:45 PM

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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Question about FWH and Excel
Posted: Fri Sep 25, 2020 04:11 PM
Code (fw): Select all Collapse
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 + MSVS 10
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Question about FWH and Excel
Posted: Mon Sep 28, 2020 04:21 AM
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about FWH and Excel
Posted: Mon Sep 28, 2020 07:29 AM

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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion