Results 1 to 2 of 2
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am using the following lines of code to fill the forecolor of a rectangle object.

    Sheets("Table").Shapes.Range("Rectangle 28").Fill.ForeColor.SchemeColor = 10

    Application.Wait Now + TimeValue("00:00:05")

    Sheets("Table").Shapes.Range("Rectangle 28").Fill.ForeColor.SchemeColor = 42



    I have placed a 5 second delay in between changing the forecolor of the object but the change of color does not take place. If I step through the code it works just fine.

    Almost as if the rectangle object needs to be refreshed.

    Any ideas as to why?

    Thanks,
    John

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Add a "DoEvents" to your code.

    Change your code to:

    Code:
    Sheets("Table").Shapes.Range("Rectangle 28").Fill.ForeColor.SchemeColor = 10
    DoEvents
    Application.Wait Now + TimeValue("00:00:05")
    
    Sheets("Table").Shapes.Range("Rectangle 28").Fill.ForeColor.SchemeColor = 42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •