The BACKGROUND COLOR OF THE COMMAND BUTTON FACES RESET TO THE DEFAULT COLOR

A

Alva Dean

I use visual basic code to check to see if a daily
spreadsheet has been created and saved. If it already
exists, the spreadsheet is opened and displayed. If the
daily spreadsheet has not been saved a template is loaded,
date and day of week are entered, and then the spreadsheet
is saved with the current day in the file name. The excel
application and the workbook are made visible and a
combobox is populated from data on worksheet(2) of the
workbook.

All this works fine. There are six command buttons on
worksheet1 that reset their backcolor when they are used
so I can tell visually when they have been used and what
meal is represented by the data in a given column.

PROBLEM --- The BACKGROUND COLOR OF THE COMMAND BUTTON
FACES RESET TO THE DEFAULT COLOR (&H8000000F&) when the
worksheet is loaded by this routine. They may initially
display with the correct colors, and change to default
color after a command button is used. I think I have seen
them cange to the default color when nothing is going on.
The command button properties box for backcolor shows the
correct color value, and the button face still shows the
system default color. If the spreadsheet is loaded from
the desktop or file open options, ther is no backcolor
changes.
 
G

Guest

Think I know what is going on.
1) The Excel spreadsheet conde is written using VB.5
 
A

Alva Dean

Think I know what is going on - no time to check yet but
seems likely.
1) code on the Excel spreadsheet is written in VB.5
2) code on program used to load the Excel App is VB.Net
3) Excel Version 9.0 is used for the Excel spreadsheets

There were changes in the way VB handles Color functions.
The VB.net runs first and becomes the version used to run
the spreadsheet code. Excel loads second and paints the
button faces the color on the command button property
sheet. When the spread sheet code is run, after
everything has loaded and for whatever reason it needs to
execute something, the VB.Net system tries to update the
button face colors using the VB.5 code and cannot make the
translation from the the .backcolor = 16777119 command to
the equivalent VB.net command so the button face color is
reset to the system default.

The question is, does this seem likely?? I will have to
set VB.Net as the default editor for the spreadsheet code,
see what fails, and rewrite it in VB.net equivalent
commands??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top