Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 66
Default formatting embedded object

I currently have a sheet programed that when a button is pressed it erases a
sheet that is there and replaces it with pulled information.

I have programmed in a label to show up when the document is erased and
replaced with the code:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Label .1", Link:=False, _
DisplayAsIcon:=False, Left:=0.75, Top:=0.75, Width:=500.25, Height:=
_
17.25).Select

My question is how to I format the label? if I completely close it and use
the code:
Worksheets("Agent Summary").label1.caption ="test"

it will work only the once when the document first loads then after that if I
use the same button it reverts back to label1

I know its an embedded label so that could be where its getting difficult.
could really use some guidence on this.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200904/1

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default formatting embedded object

Have you thought about just adding the label manually.

Then you can just hide or show the label when you want. And you'll be able to
refer to the label as label1 whenever you want.

But if you're doing all this in code, you could add the label nicely:

Dim OLEObj As OLEObject

'remove any existing OLEObject with the same name
On Error Resume Next
Worksheets("agent summary").OLEObjects("mylabelnamehere").Delete
On Error GoTo 0

Set OLEObj = Worksheets("Agent Summary").OLEObjects.Add _
(ClassType:="Forms.Label.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=0.75, _
Top:=0.75, _
Width:=500.25, _
Height:=17.25)

OLEObj.Name = "myLabelNameHere"

'maybe add the caption right after you've added it.
OLEObj.Object.Caption = "test2"

or refer to it like this if you want to change something in a different
procedure.

Worksheets("Agent Summary").OLEObjects("mylabelnamehere").Object.Cap tion _
= "test"



"Darrell_Sarrasin via OfficeKB.com" wrote:

I currently have a sheet programed that when a button is pressed it erases a
sheet that is there and replaces it with pulled information.

I have programmed in a label to show up when the document is erased and
replaced with the code:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Label .1", Link:=False, _
DisplayAsIcon:=False, Left:=0.75, Top:=0.75, Width:=500.25, Height:=
_
17.25).Select

My question is how to I format the label? if I completely close it and use
the code:
Worksheets("Agent Summary").label1.caption ="test"

it will work only the once when the document first loads then after that if I
use the same button it reverts back to label1

I know its an embedded label so that could be where its getting difficult.
could really use some guidence on this.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200904/1


--

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
Is the object linked, or embedded? JustSomeGuy Excel Discussion (Misc queries) 5 March 11th 08 07:08 PM
embedded pdf object [email protected] Excel Worksheet Functions 1 October 8th 07 04:32 PM
Linking to Embedded object CB Excel Discussion (Misc queries) 0 May 1st 07 07:36 PM
Getting an embedded object to stay put paulsuk Excel Discussion (Misc queries) 2 March 6th 07 03:27 PM
Maximize Embedded Object? meb081505 Excel Discussion (Misc queries) 0 August 16th 05 03:43 AM


All times are GMT +1. The time now is 03:14 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"