Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Set Properties of TextBox in VBA

I am adding a textbox and trying to set its properties using VBA. I get the
box but cannot figureout haw to set the properties.

Here is part of my code:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextB ox.1", Link:=False, _
DisplayAsIcon:=False, Left:=500, Top:=690, Width:=30, Height:=18). _
Select

With Selection
.Placement = xlMoveAndSize
.PrintObject = False
End With

' I want to set the properties of textbox1 here,
' but do not know how to do it. Need to set LinkedCell and Value.

Your assistance is appreciated. Thank you.
--
Don
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Set Properties of TextBox in VBA

ActiveSheet.OLEObjects("TextBox1").LinkedCell = "A1"
ActiveSheet.OLEObjects("Textbox1").Object.Value = "Text"


--
Cheers
Nigel



"Don Rouse" wrote in message
...
I am adding a textbox and trying to set its properties using VBA. I get

the
box but cannot figureout haw to set the properties.

Here is part of my code:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextB ox.1", Link:=False, _
DisplayAsIcon:=False, Left:=500, Top:=690, Width:=30, Height:=18).

_
Select

With Selection
.Placement = xlMoveAndSize
.PrintObject = False
End With

' I want to set the properties of textbox1 here,
' but do not know how to do it. Need to set LinkedCell and Value.

Your assistance is appreciated. Thank you.
--
Don



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Set Properties of TextBox in VBA

Better not to assume the name allocated

With ActiveSheet.OLEObjects
Set tb = .Add(ClassType:="Forms.TextBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=500, Top:=690, Width:=30,
Height:=18)
tb.Name = "Bob"
tb.LinkedCell = "A1"
tb.Object.Value = "Text"
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
ActiveSheet.OLEObjects("TextBox1").LinkedCell = "A1"
ActiveSheet.OLEObjects("Textbox1").Object.Value = "Text"


--
Cheers
Nigel



"Don Rouse" wrote in message
...
I am adding a textbox and trying to set its properties using VBA. I get

the
box but cannot figureout haw to set the properties.

Here is part of my code:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextB ox.1", Link:=False, _
DisplayAsIcon:=False, Left:=500, Top:=690, Width:=30,

Height:=18).
_
Select

With Selection
.Placement = xlMoveAndSize
.PrintObject = False
End With

' I want to set the properties of textbox1 here,
' but do not know how to do it. Need to set LinkedCell and Value.

Your assistance is appreciated. Thank you.
--
Don





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Set Properties of TextBox in VBA

Bob,

Thank you. It works fine.
--
Don


"Bob Phillips" wrote:

Better not to assume the name allocated

With ActiveSheet.OLEObjects
Set tb = .Add(ClassType:="Forms.TextBox.1", Link:=False, _
DisplayAsIcon:=False, Left:=500, Top:=690, Width:=30,
Height:=18)
tb.Name = "Bob"
tb.LinkedCell = "A1"
tb.Object.Value = "Text"
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
ActiveSheet.OLEObjects("TextBox1").LinkedCell = "A1"
ActiveSheet.OLEObjects("Textbox1").Object.Value = "Text"


--
Cheers
Nigel



"Don Rouse" wrote in message
...
I am adding a textbox and trying to set its properties using VBA. I get

the
box but cannot figureout haw to set the properties.

Here is part of my code:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextB ox.1", Link:=False, _
DisplayAsIcon:=False, Left:=500, Top:=690, Width:=30,

Height:=18).
_
Select

With Selection
.Placement = xlMoveAndSize
.PrintObject = False
End With

' I want to set the properties of textbox1 here,
' but do not know how to do it. Need to set LinkedCell and Value.

Your assistance is appreciated. Thank you.
--
Don






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Set Properties of TextBox in VBA

Nigel,

Thank you. Your code works fine.
--
Don


"Nigel" wrote:

ActiveSheet.OLEObjects("TextBox1").LinkedCell = "A1"
ActiveSheet.OLEObjects("Textbox1").Object.Value = "Text"


--
Cheers
Nigel



"Don Rouse" wrote in message
...
I am adding a textbox and trying to set its properties using VBA. I get

the
box but cannot figureout haw to set the properties.

Here is part of my code:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextB ox.1", Link:=False, _
DisplayAsIcon:=False, Left:=500, Top:=690, Width:=30, Height:=18).

_
Select

With Selection
.Placement = xlMoveAndSize
.PrintObject = False
End With

' I want to set the properties of textbox1 here,
' but do not know how to do it. Need to set LinkedCell and Value.

Your assistance is appreciated. Thank you.
--
Don




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
Changing textbox properties from Access VBA justme0010[_4_] Charts and Charting in Excel 0 March 11th 08 02:22 AM
Properties transferring from excel cells to word file properties lubo Excel Programming 4 July 12th 05 11:24 AM
Textbox Properties questions ForSale[_3_] Excel Programming 3 July 20th 04 04:57 AM
Copy range Cell text and font properties to a Textbox BC[_3_] Excel Programming 3 March 3rd 04 07:32 PM
TextBox Properties -- Don't move and size with cells Fred Holmes Excel Programming 1 September 4th 03 10:45 PM


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