Hi,
I want to have a simple macro to change the color in a cell of a table (not a HTML-table that is).
Lets say it’s green and it has to become red.
Anybody out there to help me?
TIA George
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
edit cell (2000)
Home » Forums » Developers, developers, developers » Web design and development » edit cell (2000)
- This topic has 31 replies, 4 voices, and was last updated 20 years, 4 months ago.
AuthorTopicSjors van der Horst
AskWoody PlusNovember 21, 2004 at 6:55 pm #412547Viewing 5 reply threadsAuthorReplies-
WSLeif
AskWoody LoungerNovember 22, 2004 at 4:44 pm #903541I don’t use macros in FP myself, but FrontPage2000/2002 Macros – Getting Started may give you a leg up.
-
Sjors van der Horst
AskWoody Plus -
Sjors van der Horst
AskWoody Plus
-
-
WSLeif
AskWoody LoungerNovember 22, 2004 at 4:44 pm #903542I don’t use macros in FP myself, but FrontPage2000/2002 Macros – Getting Started may give you a leg up.
-
WSjscher2000
AskWoody LoungerNovember 22, 2004 at 5:34 pm #903587 -
Sjors van der Horst
AskWoody PlusNovember 23, 2004 at 10:18 am #903888Hi jscher2000,
sorry, but of course it’s html-table but it looks like an excel-table.
It’s a vacancy/no vacancy table of which we have to change the color of the cells regularly.
It’s too much of a hassle to do that by hand.
That’s why I want to create several simple macro’s to change to red, orange or green and v.v.
Any ideas?
TIA
George -
WSjscher2000
AskWoody LoungerNovember 23, 2004 at 9:12 pm #904175This was a tough one. There’s only the most indirect way to get to the table cell that contains the insertion point. Please know that I’ve only done the most limited testing on this, using FrontPage 2002, but it does seem to work:
Sub CellBGRed()
Call ChangeCellBGColor(“red”)
End SubSub CellBGGreen()
Call ChangeCellBGColor(“green”)
End SubSub CellBGOrange()
Call ChangeCellBGColor(“orange”)
End SubSub ChangeCellBGColor(strColor As String)
‘ Jefferson Scher 23 Nov 2004
‘ Works from the user’s insertion point
‘ Should validate the input parameter, but…
Dim rng As Object
Set rng = ActiveDocument.Selection.createRange.parentElement
Do While LCase$(rng.tagName) “td”
Set rng = rng.parentElement
If LCase$(rng.tagName) = “body” Then
MsgBox “Not in a table cell!”
Set rng = Nothing
Exit Sub
End If
Loop
rng.Style.backgroundColor = strColor
Set rng = Nothing
End SubYou can pass either a recognized color name or a color number (e.g., #0088FF). Probably the fastest way to access these macros would be to add them to a toolbar. Do they work in FP2000?
-
Sjors van der Horst
AskWoody PlusNovember 24, 2004 at 7:17 am #904360Hi Jeff,
It works!
I only had to change: Do While LCase$(rng.tagName) “td”
into Do While LCase$(rng.tagName) <> “td” for 2000 to work.
Great and many thanx.
I would never have been able to write this.
I couldn’t believe there was not a direct way to change this.
I’ve done my part in “macro-ing” in Word and Excel, so I thought I do a quicky in FP too.
Didn’t reckon with Bill B. though
thnx again, George -
Sjors van der Horst
AskWoody PlusNovember 24, 2004 at 7:51 am #904368Jeff,
Leif sent me a mail about the difference in the 2 lines.
I answered:
Hi,
I don’t know what happened here but I copied ‘Do While LCase$(rng.tagName) “td” ‘
and edited it to ‘ Do While LCase$(rng.tagName) <> “td” ‘
While doing this I wondered if anyone would see the change!
But I guess some script changed both and <> (whithout the ; ) into <
Miracles of Window I guess.
George -
Sjors van der Horst
AskWoody Plus -
WSjscher2000
AskWoody LoungerNovember 24, 2004 at 8:11 pm #904738The lounge software tries to prevent the posting of live code, to prevent scripting attacks. When all else fails, you can export your module to a .bas file, zip it up, and post the zip file. Or open MS Paint, and paste lines of code into a textbox, and then save as GIF or PNG and attach to your post. Many ways to work around this feature.
-
WSjscher2000
AskWoody LoungerNovember 24, 2004 at 8:11 pm #904739The lounge software tries to prevent the posting of live code, to prevent scripting attacks. When all else fails, you can export your module to a .bas file, zip it up, and post the zip file. Or open MS Paint, and paste lines of code into a textbox, and then save as GIF or PNG and attach to your post. Many ways to work around this feature.
-
WSjscher2000
AskWoody LoungerNovember 24, 2004 at 8:13 pm #904748Oh, maybe the problem was with the code copied from the Lounge? If you have trouble copying and pasting “normal text” from the Web into FrontPage or any Office application, try pasting into Notepad first. It will give you the plain text only, and prevent the Office application from interpreting the clipboard contents in ways that were not intended. If you are pasting preformatted text (usually in Courier font), paste into the body of a Word document first, as otherwise you can end up with all code on one line.
-
Sjors van der Horst
AskWoody Plus -
WSjscher2000
AskWoody LoungerNovember 26, 2004 at 6:56 pm #905466It took me a while to find the page http://www.campveersetoren.nl/available.html%5B/url%5D.
To work on a range of cells really means, in this context, to work with multiple individual cells, since FrontPage’s (Internet Explorer’s) document object model doesn’t really have ranges. My code started from a selection which was expected to be inside a single cell. I’m not sure what would happen if you select across cell boundaries, but I suspect it would be something that applies to the entire row, which really would not help you down the road. I can think of various things that are a lot more work, such as UserForms that present a subset of the calendar, but… it’s a holiday here.
Added: Upon further review, the parent element is
, but the “children” collection includes all cells in the row, not merely those selected, so the basic approach would have to be changed. In creating a range of just the selection across two cells (horizontally), you can get an HTML string that includes the table tags and the tags for the two cells, but this string is “read only.” Hmmm… -
WSjscher2000
AskWoody LoungerNovember 26, 2004 at 6:56 pm #905467It took me a while to find the page http://www.campveersetoren.nl/available.html%5B/url%5D.
To work on a range of cells really means, in this context, to work with multiple individual cells, since FrontPage’s (Internet Explorer’s) document object model doesn’t really have ranges. My code started from a selection which was expected to be inside a single cell. I’m not sure what would happen if you select across cell boundaries, but I suspect it would be something that applies to the entire row, which really would not help you down the road. I can think of various things that are a lot more work, such as UserForms that present a subset of the calendar, but… it’s a holiday here.
Added: Upon further review, the parent element is
, but the “children” collection includes all cells in the row, not merely those selected, so the basic approach would have to be changed. In creating a range of just the selection across two cells (horizontally), you can get an HTML string that includes the table tags and the tags for the two cells, but this string is “read only.” Hmmm… -
Sjors van der Horst
AskWoody Plus -
Sjors van der Horst
AskWoody Plus -
Sjors van der Horst
AskWoody Plus -
WSjscher2000
AskWoody LoungerNovember 24, 2004 at 8:13 pm #904749Oh, maybe the problem was with the code copied from the Lounge? If you have trouble copying and pasting “normal text” from the Web into FrontPage or any Office application, try pasting into Notepad first. It will give you the plain text only, and prevent the Office application from interpreting the clipboard contents in ways that were not intended. If you are pasting preformatted text (usually in Courier font), paste into the body of a Word document first, as otherwise you can end up with all code on one line.
-
Sjors van der Horst
AskWoody PlusNovember 24, 2004 at 7:51 am #904369Jeff,
Leif sent me a mail about the difference in the 2 lines.
I answered:
Hi,
I don’t know what happened here but I copied ‘Do While LCase$(rng.tagName) “td” ‘
and edited it to ‘ Do While LCase$(rng.tagName) <> “td” ‘
While doing this I wondered if anyone would see the change!
But I guess some script changed both and <> (whithout the ; ) into <
Miracles of Window I guess.
George
-
-
Sjors van der Horst
AskWoody PlusNovember 24, 2004 at 7:17 am #904361Hi Jeff,
It works!
I only had to change: Do While LCase$(rng.tagName) “td”
into Do While LCase$(rng.tagName) <> “td” for 2000 to work.
Great and many thanx.
I would never have been able to write this.
I couldn’t believe there was not a direct way to change this.
I’ve done my part in “macro-ing” in Word and Excel, so I thought I do a quicky in FP too.
Didn’t reckon with Bill B. though
thnx again, George -
Sjors van der Horst
AskWoody PlusNovember 24, 2004 at 7:19 am #904362By the way, the results you can always find on http://www.campveersetoren.nl
Go to hotel, available? And you see part of your work.
Added grey and blue as well of course.
George -
Sjors van der Horst
AskWoody PlusNovember 24, 2004 at 7:19 am #904363By the way, the results you can always find on http://www.campveersetoren.nl
Go to hotel, available? And you see part of your work.
Added grey and blue as well of course.
George
-
-
WSjscher2000
AskWoody LoungerNovember 23, 2004 at 9:12 pm #904176This was a tough one. There’s only the most indirect way to get to the table cell that contains the insertion point. Please know that I’ve only done the most limited testing on this, using FrontPage 2002, but it does seem to work:
Sub CellBGRed()
Call ChangeCellBGColor(“red”)
End SubSub CellBGGreen()
Call ChangeCellBGColor(“green”)
End SubSub CellBGOrange()
Call ChangeCellBGColor(“orange”)
End SubSub ChangeCellBGColor(strColor As String)
‘ Jefferson Scher 23 Nov 2004
‘ Works from the user’s insertion point
‘ Should validate the input parameter, but…
Dim rng As Object
Set rng = ActiveDocument.Selection.createRange.parentElement
Do While LCase$(rng.tagName) “td”
Set rng = rng.parentElement
If LCase$(rng.tagName) = “body” Then
MsgBox “Not in a table cell!”
Set rng = Nothing
Exit Sub
End If
Loop
rng.Style.backgroundColor = strColor
Set rng = Nothing
End SubYou can pass either a recognized color name or a color number (e.g., #0088FF). Probably the fastest way to access these macros would be to add them to a toolbar. Do they work in FP2000?
-
-
Sjors van der Horst
AskWoody PlusNovember 23, 2004 at 10:18 am #903889Hi jscher2000,
sorry, but of course it’s html-table but it looks like an excel-table.
It’s a vacancy/no vacancy table of which we have to change the color of the cells regularly.
It’s too much of a hassle to do that by hand.
That’s why I want to create several simple macro’s to change to red, orange or green and v.v.
Any ideas?
TIA
George
-
-
WSjscher2000
AskWoody LoungerNovember 22, 2004 at 5:34 pm #903588 -
WSDrew
AskWoody Lounger -
Sjors van der Horst
AskWoody Plus -
Sjors van der Horst
AskWoody Plus
-
-
WSDrew
AskWoody Lounger
Viewing 5 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Uninstalr Updates (Awaiting moderation)
by
jv16
3 hours, 10 minutes ago -
Apple zero days for April
by
Susan Bradley
4 hours, 7 minutes ago -
CVE program gets last-minute funding from CISA – and maybe a new home
by
Nibbled To Death By Ducks
6 hours ago -
Whistleblower describes DOGE IT dept rumpus at America’s labor watchdog
by
Nibbled To Death By Ducks
6 hours, 11 minutes ago -
Seeing BSOD’s on 24H2?
by
Susan Bradley
9 hours ago -
TUT For Private Llama LLM, Local Installation and Isolated from the Internet.
by
bbearren
12 hours, 27 minutes ago -
Upgrade from Windows 10 to 11
by
Holdsworth8
14 hours, 50 minutes ago -
Microsoft : AI-powered deception: Emerging fraud threats and countermeasures
by
Alex5723
17 hours, 40 minutes ago -
0patch
by
WSjcgc50
5 hours, 25 minutes ago -
Devices might encounter blue screen exception with the recent Windows updates
by
Susan Bradley
11 hours, 2 minutes ago -
Windows 11 Insider Preview Build 22631.5261 (23H2) released to Release Preview
by
joep517
20 hours, 40 minutes ago -
Problem opening image attachments
by
RobertG
22 hours, 14 minutes ago -
advice for setting up a new windows computer
by
routtco1001
1 day, 12 hours ago -
It’s Identity Theft Day!
by
Susan Bradley
17 hours, 16 minutes ago -
Android 15 require minimum 32GB of storage
by
Alex5723
1 day, 17 hours ago -
Mac Mini 2018, iPhone 6s 2015 Are Now Vintage
by
Alex5723
1 day, 17 hours ago -
Hertz says hackers stole customer credit card and driver’s license data
by
Alex5723
1 day, 18 hours ago -
Firefox became sluggish
by
Rick Corbett
1 day, 15 hours ago -
Windows 10 Build 19045.5794 (22H2) to Release Preview Channel
by
joep517
1 day, 22 hours ago -
Windows 11 Insider Preview Build 22635.5235 (23H2) released to BETA
by
joep517
1 day, 22 hours ago -
A Funny Thing Happened on the Way to the Forum
by
bbearren
20 hours, 7 minutes ago -
Download speeds only 0.3Mbps after 24H2 upgrade on WiFi and Ethernet
by
John
47 minutes ago -
T-Mobile 5G Wireless Internet
by
WSmmi16
20 hours, 48 minutes ago -
Clock missing above calendar in Windows 10
by
WSCape Sand
22 hours ago -
Formula to Calculate Q1, Q2, Q3, or Q4 of the Year?
by
WSJon5
2 days, 13 hours ago -
The time has come for AI-generated art
by
Catherine Barrett
1 day, 17 hours ago -
Hackers are using two-factor authentication to infect you
by
B. Livingston
2 days, 3 hours ago -
23 and you
by
Max Stul Oppenheimer
2 days, 10 hours ago -
April’s deluge of patches
by
Susan Bradley
14 hours, 33 minutes ago -
Windows 11 Windows Updater question
by
Tex265
4 hours, 28 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.