Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 21st, 2004, 11:38 AM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Word VBA - Text Form Field

Hi guys,

My Excel workbook currently opens a Word document and passes various data from Excel to text form fields in Word.

Does anyone know how I can dynamically create these text form fields via VBA? I want to search a range and create these text form fields for each item in the range.

Thanks in advance.



Reply With Quote
  #2 (permalink)  
Old December 22nd, 2004, 11:09 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: , , Finland.
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Try this code
Sub InsertFormFields()
    Dim wdApp As Word.Application
    Set wdApp = New Word.Application
    wdApp.Documents.Add
    wdApp.Visible = True
    ' Insert TextBox
    wdApp.Selection.FormFields.Add Range:=wdApp.Selection.Range, Type:= _
        wdFieldFormTextInput
    wdApp.Selection.TypeParagraph
    ' Insert CheckBox
    wdApp.Selection.FormFields.Add Range:=wdApp.Selection.Range, Type:=wdFieldFormCheckBox
    wdApp.Selection.TypeParagraph
    ' Insert DropDown
    wdApp.Selection.FormFields.Add Range:=wdApp.Selection.Range, Type:=wdFieldFormDropDown
End Sub

-vemaju

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set memo field text format via VBA dlipkie Access 1 September 25th, 2008 06:54 AM
VBA code to Search All Text Fields on a form dezmond2 BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 1 July 7th, 2007 11:58 AM
Copy text from 1 doc to other doc thru vba in word itchock Word VBA 2 December 29th, 2006 02:47 AM
VBA w/ Word 2000 - Make form on top of everything mvick VB How-To 10 October 2nd, 2006 09:28 AM
Access VBA - Controlling Text boxes in a form Scripts82 Access VBA 4 February 8th, 2006 08:35 PM



All times are GMT -4. The time now is 10:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.