Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Thread Tools Display Modes
Old 06-04-2020, 03:38 AM
lizat lizat is offline Setting conditional fromat using VBA Windows 7 64bit Setting conditional fromat using VBA Office 2010 64bit
Setting conditional fromat using VBA
Join Date: Nov 2012
Posts: 4
lizat is on a distinguished road
Default Setting conditional fromat using VBA

I want to 'grey' my tasks that are complete. I created some code which set the colours wrongly (black and yellow). so i decided to reset all to neutral and then apply my colours but it doesn't quite work. i have played with colours to try and understand what is being set but have got very confused. I have checked Text styles in case that was causing any problems but nothing obvious. The problems:
  • I thought I'd set the text temporarily to red (&HFF0000) but it comes out blue, have I misunderstood something basic?
  • I can't get rid of the black and yellow, why doesn't the Case 0 - 100 catch this?
  • I there may be a way of applying default style - what is it?
  • I want to confirm I am using the correct attribute (percentComplete) but can't find a reference for this
  • i think text styles are applied before the vb is executed so can be overwritten, is that correct?
  • when I enter a six character hex code sometimes the editor creates a 'short version. e.g. &H000000 results in &H0, but this means that &H00FF00 (green) becomes &HFF00 which results in black or dark grey. How does this work?

there may be a better way to do this but here is the code:
Sub FormatCompletedTasks()

For Each tskT In ActiveProject.Tasks

Select Case tskT.PercentComplete
Case 0 - 100 'reset all to default'
SelectRow Row:=tskT.ID, RowRelative:=False
Font32Ex Color:=&H0, CellColor:=&HFFFFFF
End Select

Select Case tskT.PercentComplete
Case 100 'set 100% complete to grey
SelectRow Row:=tskT.ID, RowRelative:=False
Font32Ex Color:=&HFF0000, CellColor:=&HDDDDDD 'temp set text to red
End Select

Next tskT

End Sub
Any suggestions? Thank you
Reply With Quote

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
setting up two different businesses mdhreno Outlook 1 02-08-2012 10:10 AM
Setting conditional fromat using VBA Setting up resources icw Project 2 09-04-2011 03:55 AM
Setting conditional fromat using VBA Setting PPT 2003 jonereb PowerPoint 4 08-15-2009 07:17 AM
Can I get some help setting this up please? Moiraes Fate Office 0 05-18-2007 12:22 PM
setting rules isapaine Misc 0 01-11-2006 07:51 AM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 08:48 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd. is not affiliated with Microsoft