Jump to content

Excel: Set Background Color using some _EXCEL_* ?


rudi
 Share

Recommended Posts

Hello,

I used the various "_Excel_*()" funktions to open workbooks, read and write cells.

 

I was looking through the helpfile for the _EXCEL_* funktions, if there is a direkt way to set background color or text color -- if there is one, then I missed it?

 

Searching the forum I found this posting demonstrating how to do this task using ...

ObjCreate("Excel.Application")

 

Is there a way to set the background color etc. with the native "_EXCEL_*" as well?

 

Regards, Rudi.

 

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Hi.

And what is (or is not) the difference between $oExcel and $oWB?

#include <Excel.au3>


$XLWB="C:\temp\Excel-Background-Test.xlsx" ; the Excel file does exist already

$oExcel = _Excel_Open()
$oWB = _Excel_BookOpen($oExcel, $XLWB)

$oWB.ActiveSheet.Range("A1").Value = "Blue on Red" ; Text
$oWB.ActiveSheet.Range("A1").Interior.ColorIndex=3 ; red background
$oWB.ActiveSheet.Range("A1").Font.ColorIndex=5 ; blue text color

 

Thanks a lot!

 

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

$oWB.ActiveSheet.Range("A1").Interior.Color = <ColorValue>

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...