Page 1 of 1

Question about FWH and Excel

Posted: Thu Sep 24, 2020 9:05 am
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.

Re: Question about FWH and Excel

Posted: Thu Sep 24, 2020 10:43 am
by ADutheil
Try this
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( 1, 7 ) ):Interior:ColorIndex := Violeta

Re: Question about FWH and Excel

Posted: Thu Sep 24, 2020 10:45 am
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?

Re: Question about FWH and Excel

Posted: Thu Sep 24, 2020 3:43 pm
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/

Re: Question about FWH and Excel

Posted: Thu Sep 24, 2020 3:57 pm
by driessen
And how do you adapt vrom VBA to FWH?

Re: Question about FWH and Excel

Posted: Fri Sep 25, 2020 12:55 pm
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.

Re: Question about FWH and Excel

Posted: Fri Sep 25, 2020 1:45 pm
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.

Re: Question about FWH and Excel

Posted: Fri Sep 25, 2020 4:11 pm
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.

Re: Question about FWH and Excel

Posted: Mon Sep 28, 2020 4:21 am
by hua

Re: Question about FWH and Excel

Posted: Mon Sep 28, 2020 7:29 am
by driessen
Thank you all very much.
I found a answer to all my question, thanks to your help.