Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

using textfields and VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Devlon - 25 Mar 2005 00:50 GMT
Hi,

I've created a word-file with a few textfields from the Toolbox controls.

Does anyone know how to get the value of these fields using VBA ?

ThisDocument.form("txtName").Result

... does not work

Thanx

John
Helmut Weber - 25 Mar 2005 02:03 GMT
Hi John,
I doubt whether this has to be that complicated.
And I'm assuming, that your textfields are inlineshapes, not shapes.
Otherwise repeat all using shape instead of inlineshape.
Until someone else comes up with a better solution...

Sub Makro4()
Dim oShp As InlineShape
For Each oShp In ActiveDocument.InlineShapes
  If oShp.Type = wdInlineShapeOLEControlObject Then
     If oShp.OLEFormat.ClassType = "Forms.TextBox.1" Then
        MsgBox oShp.OLEFormat.Object.Name
        MsgBox oShp.OLEFormat.Object.Value
     End If
  End If
Next
End Sub

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.