Dynamic Label Caption

T

Turtle MacDermott

I have a spreadsheet which I am filling from Access using VBA.
I put a label on it, using the Controls Toolbox.
The label's caption reads "Created:"

In VBA, I set
ActiveSheet.OLEObjects("MyLabel").object.caption="Created: " & Now()

When I step through the code, I see the caption being set correctly.

Now, when I look at the spreadsheet, I see the original caption, "Created:"
without the date.
But if I click on the label, it shows the entire value.
Click off it to something else, and it returns to the original value.

How can I make it display the new value even when the label is not selected?

TIA
- Turtle
 
G

Guest

Sounds like you have something (possibly just a space " ") in the sell to the
right of the label. If so, delete it and the full caption should show.
HTH,
Gary Brown
 
M

MacDermott

Thanks a lot for the tip, Gary!

Unfortunately, that doesn't seem to have been the problem.
I've been playing around a bit, and have found the same thing with both
labels and textboxes.
If I change a label's caption, or a textbox's text or value in code, the
spreadsheet shows the old value until I click on the control. Then it shows
the new value.
I continue to see the new value as long as the focus stays on a control.
As soon as I set it back to a spreadsheet cell, the old value returns.
It's as if there's another property that has to be set.

Any ideas?
TIA!
- Turtle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top