After the scripts are run, the tabs look like this:
The Cover Page and PAYMENT INSTRUCTIONS sheets always exist. The 123 sheet represents a facility and there is always one facility (the number varies depending on the facility) but each facility included in the Workbook gets its own tab identified by the facility number. The DESCRIPTION sheet may or may not exist.
I'm trying to figure out the best way to check all the spreadsheet names and act on each sheet depending on the name. So, if the worksheet is a three digit number, it means its a facility so I would want to change it to the facility name (there are 10 different facilities) and change the tab color. I leave the Cover Page sheet as is. I change the PAYMENT INSTRUCTIONS tab and DESCRIPTION tab (if it exists) to different colors.
Currently, for 123 sheet, I use the following to change it from the number value assigned the facility to the facility name and changes the tab color:
Code: Select all
appExcel := ComObjCreate("Excel.Application")
MC := appExcel.sheets(2).name
if (MC="123")
{
appExcel.sheets(2).name := "The General Building"
appExcel.Sheets(2).Tab.Color := 0xFF901E
}
else if (MC="456")
{
appExcel.sheets(2).name := "Another Building"
appExcel.Sheets(2).Tab.Color := 0x00FFFF
}
Code: Select all
appExcel.Sheets("DESCRIPTION").Tab.Color := 0x32CD32
appExcel.Sheets("PAYMENT INSTRUCTIONS").Tab.Color := 0xFF901E