VBA read colors from file

luckydead21

New Member
Joined
Mar 21, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello, can someone help me how to make this in MS access VBA code to read from .txt file the colors

Example: Let's say my file name is called "Colors.txt"
Inside of it i have this information:

"W" = RGB(255,255,255)
"B" = RGB(0,0,0)
and so one..
And inside my access file i have table where it reads item color so i type there for example "B"
and when execute the fetch it will read "B" color from .txt file and display the color

Can someone help me to build such function or code?
Thanks


EDIT:
For now i use in VBA with Case
If case = "B" then do something
case = "W/B" then do something and so one
 
Last edited by a moderator:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
example the best idea i got in my mind is to read only the information from the file
in my file Colors.txt i have input this codes:
VBA Code:
Select Case Col1.Text
Case "B"
    color1_1.BackColor = RGB(0, 0, 0)
    color1_2.Visible = False

Case "B/BR"
    color1_1.BackColor = RGB(0, 0, 0)
    color1_2.Visible = True
    color1_2.BackColor = RGB(128, 64, 0)
End Select

How to make to read the entire file information like its writed in the .txt file not to be in single string or line. To read all lines the same as are in .txt ? maybe this can solve my issues faster
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,513
Members
448,967
Latest member
screechyboy79

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top