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
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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, 6 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
-
Who knows what?
by
Will Fastie
43 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
7 minutes ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
45 minutes ago -
Misbehaving devices
by
Susan Bradley
46 minutes ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
13 hours, 53 minutes ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
9 hours, 36 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
12 hours, 27 minutes ago -
Discover the Best AI Tools for Everything
by
Alex5723
12 hours, 35 minutes ago -
Edge Seems To Be Gaining Weight
by
bbearren
2 hours, 44 minutes ago -
Rufus is available from the MSFT Store
by
PL1
10 hours, 47 minutes ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
1 day, 13 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
20 hours, 3 minutes ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
16 hours, 14 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
1 day, 9 hours ago -
Office gets current release
by
Susan Bradley
1 day, 12 hours ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
3 days, 2 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
2 days, 10 hours ago -
Stop the OneDrive defaults
by
CWBillow
3 days, 2 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
3 days, 12 hours ago -
X Suspends Encrypted DMs
by
Alex5723
3 days, 15 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
3 days, 15 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
3 days, 15 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
3 days, 16 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
3 days, 4 hours ago -
Enabling Secureboot
by
ITguy
3 days, 11 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
4 days ago -
No more rounded corners??
by
CWBillow
3 days, 20 hours ago -
Android 15 and IPV6
by
Win7and10
3 days, 10 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
4 days, 12 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
4 days, 15 hours ago
Recent blog posts
Key Links
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
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.