?
Solved

Transfer colour from Excel to VB form

Posted on 2003-03-17
3
Medium Priority
?
165 Views
Last Modified: 2010-05-03
I would like to get my VB program (VB5) to 'read' the background colour of a cell in Excel and then change the background colour of a label on a VB form to the same colour.

The following code has changed the label's colour, but not to the right one!

lblExample.BackColor = wkbExample.Worksheets("Example").Cells(1, 1).Interior.ColorIndex

If anyone has any suggestions then I would be very grateful.
Thanks.
0
Comment
Question by:DudBug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 3

Expert Comment

by:DocM
ID: 8154507
Hy,
See The 56 Excel Colors - Color Palette - RGB equivalence
at  
http://www.geocities.com/davemcritchie/excel/colors.htm
0
 
LVL 3

Expert Comment

by:DocM
ID: 8154646
Hy,
See The 56 Excel Colors - Color Palette - RGB equivalence
at  
http://www.geocities.com/davemcritchie/excel/colors.htm
0
 
LVL 3

Accepted Solution

by:
DocM earned 80 total points
ID: 8154663

Instead of the colorindex property, use the color property.

lblExample.BackColor = wkbExample.Worksheets("Example").Cells(1, 1).Interior.Color which will give the RGB color value.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question