Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-30-2014, 12:44 PM
gmaxey gmaxey is offline Find textbox name Windows 7 32bit Find textbox name Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

What kind of textbox?

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oCC As ContentControl
Dim oILS As InlineShape
  'A formfield
  If Selection.FormFields.Count = 1 Then
    MsgBox Selection.FormFields(1).Name
  ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
    MsgBox Selection.Bookmarks(Selection.Bookmarks.Count).Name
  End If
  'A content control
  For Each oCC In ActiveDocument.Range.ContentControls
    If Selection.Range.InRange(oCC.Range) Then MsgBox oCC.Title
  Next oCC
  'A activeX control
  For Each oILS In ActiveDocument.InlineShapes
    If Selection.Range.InRange(oILS.Range) Then
      MsgBox oILS.OLEFormat.Object.Name
    End If
  Next
End Sub
See: http://gregmaxey.com/word_tip_pages/...ng_macros.html for instructions to employ the VBA code provided above.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
clip art with embeded textbox Mel Spence Misc 0 05-19-2013 09:38 AM
Find textbox name Display result in textbox based on the input of another textbox scarymovie Word VBA 5 05-16-2012 07:05 PM
textbox color issue Dave Duncan Word 0 08-07-2011 10:38 AM
Textbox Template t0m46 Word 0 09-07-2010 03:38 AM
Creating Chart using VB textbox value shyler82 Word VBA 0 03-12-2010 06:56 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:23 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