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 / November 2006

Tip: Looking for answers? Try searching our database.

Simple Form Syntax Help Please

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Angyl - 06 Nov 2006 19:00 GMT
I've tried this several ways and can't get it to work.  I'm adding a macro to
a field and I want another field to change in the document based on what was
entered, but I'm having trouble referencing the field properly.

I've tried

If ActiveDocument.Text1.Text = "Hello" Then

and just

If Text1.Text = "Hello" Then

and

With ActiveDocument

If .FormFields.Text1.Text = "Hello" Then

and a couple others but I keep getting various errors.  What's the proper
syntax for referencing a form field named Text 1 in a macro?
Greg Maxey - 06 Nov 2006 19:15 GMT
Something like this should get you on track:
Sub ScratchMacro()
With ActiveDocument
 If .FormFields("Text1").Result = "Hello" Then
   MsgBox "Bob's your uncle"
 End If
End With
End Sub

> I've tried this several ways and can't get it to work.  I'm adding a macro to
> a field and I want another field to change in the document based on what was
[quoted text clipped - 16 lines]
> and a couple others but I keep getting various errors.  What's the proper
> syntax for referencing a form field named Text 1 in a macro?
Angyl - 06 Nov 2006 23:15 GMT
Many thanks, Greg.

> Something like this should get you on track:
> Sub ScratchMacro()
[quoted text clipped - 25 lines]
> > and a couple others but I keep getting various errors.  What's the proper
> > syntax for referencing a form field named Text 1 in a macro?
 
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.