Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA problem - text boxes

How can i get round the problem that when i get a macro to make a tex
box and assign a macro to it (In which the text box is deleted aswel
as returning row heights to their original height) the text box numbe
is incremented so I can't reselect the text box after i have deselecte
it to delete it?

Any suggestionswould be useful!

Thanks

Carl Jone

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA problem - text boxes

If you are adding a textbox, it is a new textbox. You just need to assign a
name to it rather than keeping the default name. Show your code for adding
the textbox and I can tell you how to rename it. (also, what version of
Excel you will be using)

--
Regards,
Tom Ogilvy


"carljonesuk " wrote in message
...
How can i get round the problem that when i get a macro to make a text
box and assign a macro to it (In which the text box is deleted aswell
as returning row heights to their original height) the text box number
is incremented so I can't reselect the text box after i have deselected
it to delete it?

Any suggestionswould be useful!

Thanks

Carl Jones


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA problem - text boxes

Im using Excel 2000. I also want to assign a macro to the text box.
know how to do this!! This is the code for the macro:-

Sheets("Quote").Select
Application.CommandBars("Drawing").Visible = True
ActiveSheet.Shapes.AddTextbox(msoTextOrientationDo wnward, 339.75
130.5, _
248.25, 149.25).Select
Selection.Characters.Text = "Back To Normal"
With Selection.Characters(Start:=1, Length:=14).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = xlHorizontal
.AutoSize = False
End With
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 40
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 64
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Range("G22").Selec

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA problem - text boxes

The below code always gives it the name Text Box 2 (change to fit your
needs).

Sub Tester2()
Sheets("Quote").Select
Application.CommandBars("Drawing").Visible = True

With ActiveSheet.Shapes.AddTextbox( _
msoTextOrientationDownward, _
339.75, _
130.5, _
248.25, _
149.25)

' Name the Textbox

.Name = "Text box 2"
.Select
End With
Selection.Characters.Text = "Back To Normal"
With Selection.Characters(Start:=1, Length:=14).Font
Name = "Arial"
FontStyle = "Bold"
Size = 14
Strikethrough = False
Superscript = False
Subscript = False
OutlineFont = False
Shadow = False
Underline = xlUnderlineStyleNone
ColorIndex = xlAutomatic
End With
With Selection
HorizontalAlignment = xlCenter
VerticalAlignment = xlCenter
Orientation = xlHorizontal
AutoSize = False
End With
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 40
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 64
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Range("G22").Select

End Sub

--
Regards,
Tom Ogilvy

"carljonesuk " wrote in message
...
Im using Excel 2000. I also want to assign a macro to the text box. I
know how to do this!! This is the code for the macro:-

Sheets("Quote").Select
Application.CommandBars("Drawing").Visible = True
ActiveSheet.Shapes.AddTextbox(msoTextOrientationDo wnward, 339.75,
130.5, _
248.25, 149.25).Select
Selection.Characters.Text = "Back To Normal"
With Selection.Characters(Start:=1, Length:=14).Font
Name = "Arial"
FontStyle = "Bold"
Size = 14
Strikethrough = False
Superscript = False
Subscript = False
OutlineFont = False
Shadow = False
Underline = xlUnderlineStyleNone
ColorIndex = xlAutomatic
End With
With Selection
HorizontalAlignment = xlCenter
VerticalAlignment = xlCenter
Orientation = xlHorizontal
AutoSize = False
End With
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 40
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 64
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Range("G22").Select


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA problem - text boxes

So then i Just type the name i give the text box into the macro i Use to
delete it?


---
Message posted from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA problem - text boxes

To refer to the textbox, you use the name of the textbox. When you add it,
you give it a specific name, so it always has the same name. That really is
the point of having a name isn't it.

--
Tom Ogilvy

carljonesuk wrote in message
...
So then i Just type the name i give the text box into the macro i Use to
delete it?


---
Message posted from http://www.ExcelForum.com/



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
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
How do I link Text Boxes to Cells, not Cells to Text Boxes? Ebby Excel Worksheet Functions 1 May 15th 07 11:31 PM
VBA Coding problem -text boxes (more) Bourbon[_15_] Excel Programming 4 January 15th 04 07:47 PM
VBA Coding problem -text boxes Bourbon[_13_] Excel Programming 2 January 15th 04 04:22 PM
VBA Coding problem -text boxes Bourbon[_10_] Excel Programming 3 January 14th 04 10:36 PM


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