Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2014, 07:57 PM
excelledsoftware excelledsoftware is offline TextBox / Shape name Windows 7 64bit TextBox / Shape name Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

I use this code snippet to name my shapes as well as get the name for them.



Code:
Sub Name()

  Dim sResponse As String

  With ActiveWindow.Selection.ShapeRange(1)
    sResponse = InputBox("new name ...", "Rename Shape", .Name)
    Select Case sResponse
     ' blank names not allowed
     Case Is = ""
       Exit Sub
     ' no change?
     Case Is = .Name
       Exit Sub
     Case Else
       On Error Resume Next
       .Name = sResponse
       If Err.Number <> 0 Then
         MsgBox "Unable to rename this shape"
       End If
    End Select
  End With

End Sub
I run this macro to a button on my toolbar and then just click it when I need the name of a shape. You could probably do something similar if you wanted a less bloated version. Maybe like

Code:
Sub name2()
  Dim x As String

  On Error Resume Next
  x = ActiveWindow.Selection.ShapeRange(1).name
  If x <> "" Then MsgBox x
  On Error GoTo 0
End Sub
Let me know Thanks
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox / Shape name Userform VBA Textbox Calculation MarkAn Word VBA 2 08-15-2014 06:50 AM
TextBox / Shape name Find textbox name Hdata Word VBA 17 02-01-2014 06:50 AM
TextBox / Shape name locking shape within shape cpwljaw Drawing and Graphics 1 08-28-2012 12:13 AM
TextBox / Shape name Display result in textbox based on the input of another textbox scarymovie Word VBA 5 05-16-2012 07:05 PM
Textbox Template t0m46 Word 0 09-07-2010 03:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft