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, 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
GeorgeWSjscher2000
AskWoody LoungerNovember 22, 2004 at 5:34 pm #903588WSDrew
AskWoody Lounger-
Sjors van der Horst
AskWoody Plus -
Sjors van der Horst
AskWoody Plus
WSDrew
AskWoody LoungerViewing 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
-
Installing Feature Update Windows 11 24H2
by
geekdom
6 hours, 43 minutes ago -
Windows 11 Insider Preview build 27823 released to Canary
by
joep517
7 hours, 7 minutes ago -
Windows 11 Hotpatch
by
Hackmuss
1 hour, 59 minutes ago -
System Guard service error still won’t be fixed
by
Susan Bradley
7 hours, 46 minutes ago -
Operation ForumTroll: APT attack with Google Chrome zero-day exploit chain
by
Alex5723
1 hour, 57 minutes ago -
Troy Hunt of HaveIBeenPwned Phished
by
Lars220
1 hour, 55 minutes ago -
Microsoft Windows security auditing Code 5061
by
mpw
20 hours, 19 minutes ago -
Can’t display images in incoming Outlook 365 emails
by
WScopwriter
3 hours, 55 minutes ago -
Windows 11 Insider Preview Build 26200.5510 early builds of 25H2
by
Alex5723
5 hours, 23 minutes ago -
0Patch : Micropatches released for SCF File NTLM Hash Disclosure Vulnerability
by
Alex5723
4 hours, 52 minutes ago -
Select multiple emails and they all open up!
by
CeeJay
1 day, 21 hours ago -
How to remove an update preview
by
Gunny
16 minutes ago -
Third party add ins reminder
by
Susan Bradley
1 day, 1 hour ago -
OTF, which backs Tor, Let’s Encrypt and more, sues to save its funding
by
Nibbled To Death By Ducks
1 day, 15 hours ago -
Updating Windows 10 to Windows 11: 23H2 or 24H2?
by
Still Anonymous
2 days, 1 hour ago -
How can I update “Explorer Patcher”
by
WSplanckster
2 days, 3 hours ago -
Check out the home page for Signal
by
CAS
2 days, 1 hour ago -
Windows 11 and Trial version of MS Office
by
Tex265
2 days ago -
Windows 11 Insider Preview build 26120.3585 (24H2) released to BETA
by
joep517
2 days, 8 hours ago -
Windows 11 Insider Preview build 26200.5510 released to DEV
by
joep517
2 days, 8 hours ago -
Windows 11 Insider Preview Build 26100.3624 (24H2) released to Release Preview
by
joep517
2 days, 8 hours ago -
Limits on User Names
by
CWBillow
2 days, 4 hours ago -
MS-DEFCON 4: Mixed bag for March
by
Susan Bradley
4 hours, 57 minutes ago -
Non Apple Keyboards
by
pmcjr6142
6 hours, 14 minutes ago -
How to delete your 23andMe data – The Verge
by
AJNorth
2 days, 2 hours ago -
7 common myths about Windows 11 (Microsoft AD)
by
EyesOnWindows
2 days ago -
Error updating to Win11 0x8024a205
by
bmeacham
17 minutes ago -
default apps
by
chasfinn
1 day, 8 hours ago -
Will MS Works 4 work in MS Win 11?
by
MileHighFlyer
2 minutes ago -
Adding links to text in Word 2000
by
sgeneris
2 days, 7 hours ago
Recent blog posts
- System Guard service error still won’t be fixed
- Third party add ins reminder
- MS-DEFCON 4: Mixed bag for March
- Classic and Extended Control Panel — no need to say goodbye
- Things you can do in 2025 that you couldn’t do in 2024
- Revisiting Windows 11’s File Explorer
- Planning ahead for migration
- Woody Leonhard (1951–2025)
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.