Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Changing text in a Text Box

This code works but I don't want to use "select" if I don't have to.
The Textbox is from the drawing toolbar.
How do I change the text without first selecting the textbox?


Sub SetTextBoxValue()
ActiveSheet.Shapes("Text Box 8").Select
Selection.Characters.Text = "My Text"
Range("A1").Select
End Sub

--
Regards,
Rocky McKinley



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Changing text in a Text Box

Hi Rocky,

Try:

Sub SetTextBoxValue()
ActiveSheet.TextBoxes("Text Box 8").Text = "My Text"
End Sub

---
Regards,
Norman



"Rocky McKinley" wrote in message
...
This code works but I don't want to use "select" if I don't have to.
The Textbox is from the drawing toolbar.
How do I change the text without first selecting the textbox?


Sub SetTextBoxValue()
ActiveSheet.Shapes("Text Box 8").Select
Selection.Characters.Text = "My Text"
Range("A1").Select
End Sub

--
Regards,
Rocky McKinley





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Changing text in a Text Box

Thanks, I wonder why when in the Vb editor when I type "ActiveSheet."
that "TextBoxes" doesn't appear in the list that appears?

--
Regards,
Rocky McKinley


"Norman Jones" wrote in message
...
Hi Rocky,

Try:

Sub SetTextBoxValue()
ActiveSheet.TextBoxes("Text Box 8").Text = "My Text"
End Sub

---
Regards,
Norman



"Rocky McKinley" wrote in message
...
This code works but I don't want to use "select" if I don't have to.
The Textbox is from the drawing toolbar.
How do I change the text without first selecting the textbox?


Sub SetTextBoxValue()
ActiveSheet.Shapes("Text Box 8").Select
Selection.Characters.Text = "My Text"
Range("A1").Select
End Sub

--
Regards,
Rocky McKinley







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Changing text in a Text Box

Hi Rocky,

Thanks, I wonder why when in the Vb editor when I type "ActiveSheet." that
"TextBoxes" doesn't appear in the list that appears?


There are two separate problems he

(1) ActiveSheet will not provide intellisense prompts because VBA is not
aware if the sheet im question is a work sheet, a chart sheet, a macro sheet
or a dialog sheet.

A way round this would be:

Dim sh As Worksheet

Set sh = ActiveSheet

Then, typing sh. invokes thr relevant intellisense list, as VBA now knows
the sheet type.

(2) the second problem is that the TextBoxes are now classified as hidden
objects and so intellisense is provided. See 'Hidden Objects' in VBA help.

A way way round this would be:

Dim sh As Worksheet
Dim TBox As TextBox

Set sh = ActiveSheet

Set TBox = ActiveSheet.TextBoxes("Text Box 8")
TBox.Text = "My Text"

This way, as soon as TBox is typed, the TextBox intellisense list is
invoked.

---
Regards,
Norman



"Rocky McKinley" wrote in message
...
Thanks, I wonder why when in the Vb editor when I type "ActiveSheet." that
"TextBoxes" doesn't appear in the list that appears?

--
Regards,
Rocky McKinley


"Norman Jones" wrote in message
...
Hi Rocky,

Try:

Sub SetTextBoxValue()
ActiveSheet.TextBoxes("Text Box 8").Text = "My Text"
End Sub

---
Regards,
Norman



"Rocky McKinley" wrote in message
...
This code works but I don't want to use "select" if I don't have to.
The Textbox is from the drawing toolbar.
How do I change the text without first selecting the textbox?


Sub SetTextBoxValue()
ActiveSheet.Shapes("Text Box 8").Select
Selection.Characters.Text = "My Text"
Range("A1").Select
End Sub

--
Regards,
Rocky McKinley









  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Changing text in a Text Box

Thanks Norman

--
Regards,
Rocky McKinley


"Norman Jones" wrote in message
...
Hi Rocky,

Thanks, I wonder why when in the Vb editor when I type "ActiveSheet."
that "TextBoxes" doesn't appear in the list that appears?


There are two separate problems he

(1) ActiveSheet will not provide intellisense prompts because VBA is not
aware if the sheet im question is a work sheet, a chart sheet, a macro
sheet or a dialog sheet.

A way round this would be:

Dim sh As Worksheet

Set sh = ActiveSheet

Then, typing sh. invokes thr relevant intellisense list, as VBA now knows
the sheet type.

(2) the second problem is that the TextBoxes are now classified as hidden
objects and so intellisense is provided. See 'Hidden Objects' in VBA help.

A way way round this would be:

Dim sh As Worksheet
Dim TBox As TextBox

Set sh = ActiveSheet

Set TBox = ActiveSheet.TextBoxes("Text Box 8")
TBox.Text = "My Text"

This way, as soon as TBox is typed, the TextBox intellisense list is
invoked.

---
Regards,
Norman



"Rocky McKinley" wrote in message
...
Thanks, I wonder why when in the Vb editor when I type "ActiveSheet."
that "TextBoxes" doesn't appear in the list that appears?

--
Regards,
Rocky McKinley


"Norman Jones" wrote in message
...
Hi Rocky,

Try:

Sub SetTextBoxValue()
ActiveSheet.TextBoxes("Text Box 8").Text = "My Text"
End Sub

---
Regards,
Norman



"Rocky McKinley" wrote in message
...
This code works but I don't want to use "select" if I don't have to.
The Textbox is from the drawing toolbar.
How do I change the text without first selecting the textbox?


Sub SetTextBoxValue()
ActiveSheet.Shapes("Text Box 8").Select
Selection.Characters.Text = "My Text"
Range("A1").Select
End Sub

--
Regards,
Rocky McKinley













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
change the text in the legend of a chart w/o changing pivot text msp Charts and Charting in Excel 2 December 17th 08 08:53 PM
Graph while ignoring text but not changing text to #NA haruun Charts and Charting in Excel 1 April 29th 08 01:49 AM
Changing none text entry to text? Ross Excel Discussion (Misc queries) 1 July 5th 07 11:18 AM
Changing the colour of text packfan Excel Discussion (Misc queries) 1 November 27th 06 04:41 AM
Changing text to value Lynn Burrow Excel Discussion (Misc queries) 4 January 23rd 06 11:01 PM


All times are GMT +1. The time now is 02:53 AM.

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

About Us

"It's about Microsoft Excel"