Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dynamic Label Caption

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Dynamic Label Caption

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


"Turtle MacDermott" wrote:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Dynamic Label Caption

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

"Gary Brown" wrote in message
...
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


"Turtle MacDermott" wrote:

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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Dynamic Label Caption

No I don't. Sorry,
Gary Brown

"MacDermott" wrote:

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

"Gary Brown" wrote in message
...
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


"Turtle MacDermott" wrote:

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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Dynamic Label Caption

I couldn't reproduce your description either.

But if you minimize the worksheet (or even the application), then resize, do you
still see the problem.

When I've added controlbuttons (also from the control toolbox toolbar), I
sometimes can't see them until I do this--I think it's a screen refreshing thing
(technical term!).

Maybe adding a DoEvents to your code would help (maybe not).

And I think I'd try the label from the Forms toolbar to see if that behaved
better.

=====
But I don't have a guess about what you describe in your follow up.

MacDermott wrote:

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

"Gary Brown" wrote in message
...
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


"Turtle MacDermott" wrote:

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




--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Dynamic Label Caption

Thanks for your ideas!

I've tried the label from the Forms toolbar, and to my joy found that it
displayed a new text very well.
I'm a bit perplexed that I can't find anywhere to set properties like font
and textalign, but that's not a showstopper.
(not being able to reliably change the text was.)

Of course the situation isn't quite as simple as I reported.
Here are a couple of additional aspects which I had omitted, presuming they
weren't relevant.
1. I'm using Office XP for this work.
2. The label in question is on a template; I'm opening a new spreadsheet
based on that template.
3. The code is actually in Access; I'm using Automation to run code on an
Excel spreadsheet I open.

I can move forward with what I have now, but if anyone has any insights on
setting properties on a Forms label (on a spreadsheet - it's easy if it's on
a form), or thinks any of the above 3 points might have some relevance, I'd
be delighted to hear more.

- Turtle

"Dave Peterson" wrote in message
...
I couldn't reproduce your description either.

But if you minimize the worksheet (or even the application), then resize,

do you
still see the problem.

When I've added controlbuttons (also from the control toolbox toolbar), I
sometimes can't see them until I do this--I think it's a screen refreshing

thing
(technical term!).

Maybe adding a DoEvents to your code would help (maybe not).

And I think I'd try the label from the Forms toolbar to see if that

behaved
better.

=====
But I don't have a guess about what you describe in your follow up.

MacDermott wrote:

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

"Gary Brown" wrote in message
...
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


"Turtle MacDermott" wrote:

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




--

Dave Peterson



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Dynamic Label Caption

Many (most???) properties that are available with the Control toolbox toolbar's
label aren't available in the Form toolbar's Label.


MacDermott wrote:

Thanks for your ideas!

I've tried the label from the Forms toolbar, and to my joy found that it
displayed a new text very well.
I'm a bit perplexed that I can't find anywhere to set properties like font
and textalign, but that's not a showstopper.
(not being able to reliably change the text was.)

Of course the situation isn't quite as simple as I reported.
Here are a couple of additional aspects which I had omitted, presuming they
weren't relevant.
1. I'm using Office XP for this work.
2. The label in question is on a template; I'm opening a new spreadsheet
based on that template.
3. The code is actually in Access; I'm using Automation to run code on an
Excel spreadsheet I open.

I can move forward with what I have now, but if anyone has any insights on
setting properties on a Forms label (on a spreadsheet - it's easy if it's on
a form), or thinks any of the above 3 points might have some relevance, I'd
be delighted to hear more.

- Turtle

"Dave Peterson" wrote in message
...
I couldn't reproduce your description either.

But if you minimize the worksheet (or even the application), then resize,

do you
still see the problem.

When I've added controlbuttons (also from the control toolbox toolbar), I
sometimes can't see them until I do this--I think it's a screen refreshing

thing
(technical term!).

Maybe adding a DoEvents to your code would help (maybe not).

And I think I'd try the label from the Forms toolbar to see if that

behaved
better.

=====
But I don't have a guess about what you describe in your follow up.

MacDermott wrote:

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

"Gary Brown" wrote in message
...
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


"Turtle MacDermott" wrote:

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




--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
label caption gramps Excel Discussion (Misc queries) 0 November 1st 07 03:56 PM
Is it a comment ? or a label ? or a caption ?.... mars Excel Discussion (Misc queries) 2 May 24th 07 11:15 PM
Label - Caption not changing Brian Hribek Excel Programming 1 October 11th 04 09:19 PM
changing the caption of a label Koos Excel Programming 4 October 18th 03 02:36 PM
label caption Rod Taylor Excel Programming 2 July 31st 03 03:25 AM


All times are GMT +1. The time now is 11:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"