![]() |
|
|
|
#1
|
|||
|
|||
|
I suggest you employ a userform for initially creating the document: http://gregmaxey.com/word_tip_pages/..._userform.html |
|
#2
|
|||
|
|||
|
I think this macro would replace the fill-in fields with the text that shows up as the result after the field is filled in:
Sub UnlinkFillInFields() Dim myField As Field For Each myField In ActiveDocument.Fields If myField.Type = wdFieldFillIn Then myField.Unlink End If Next myField End Sub |
|
#3
|
|||
|
|||
|
Quote:
I think I'm about 90% there following your instructions, but I think I'm missing something because it doesn't quite work :/ I have a form with 3 text boxes (GrpName, PriorPY, CurrentPY) and two combo boxes (PYMonth1, PYMonth2). The trouble I'm experiencing is trying to get the data entered in the form into the document. Here's what I have (the "var" reference in VBA matches the field in the word document) Code:
Option Explicit
Sub AutoNew()
Create_Reset_Variables
CallUF
lbl_Exit:
Exit Sub
End Sub
Sub CallUF()
Dim oFrm As frmSurvey
Dim oVars As Word.Variables
Dim strTemp As String
Dim oRng As Word.Range
Dim i As Long
Dim strMultiSel As String
Set oVars = ActiveDocument.Variables
Set oFrm = New frmSurvey
With oFrm
.Show
oVars("varGrpName").Value = .txtGrpName
oVars("varCurrentPY").Value = .txtCurrentPY
oVars("varPriorPY").Value = .txtPriorPY
oVars("varPYMonth1").Value = .txtPYMonth1
oVars("varPYMonth2").Value = .txtPYMonth2
Else
MsgBox "Form cancelled by user"
End If
End With
Unload oFrm
Set oFrm = Nothing
Set oVars = Nothing
Set oRng = Nothing
lbl_Exit:
Exit Sub
End Sub
Many thanks! |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to find text and replace with form field containing that text
|
iiiiifffff | Word VBA | 16 | 06-04-2016 01:47 AM |
MS WORD 2007 - Content Control versus Text Form Field question
|
chamdan | Word VBA | 2 | 11-12-2013 09:51 PM |
| Macro to populate a text form field based on dropdown selection | koloa | Word | 0 | 10-20-2011 11:52 AM |
FILLIN function
|
Andy2011 | Word | 9 | 10-19-2011 02:51 PM |
Word Macro That Checks a Check Box Form Field When File Print is Executed
|
DKerne | Word VBA | 4 | 06-09-2011 11:54 AM |