Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 04-05-2015, 02:59 PM
jer85's Avatar
jer85 jer85 is offline Macro to keep formatted form fields after mail merge or replace text with formatted form fields Windows 7 32bit Macro to keep formatted form fields after mail merge or replace text with formatted form fields Office 2010 32bit
Novice
Macro to keep formatted form fields after mail merge or replace text with formatted form fields
 
Join Date: Mar 2015
Location: Budapest, Hungary
Posts: 2
jer85 is on a distinguished road
Default

Hi! For Problem 1 solution I'd still be grateful, however I've found a solution for Problem 2:

Sub Makró1()

Dim oFF1 As FormField
Dim oFF2 As FormField
Dim oFFx As FormField
Dim sFindText As String

Selection.HomeKey wdStory
sFindText = "f1"
Selection.Find.Execute sFindText
Do Until Selection.Find.Found = False
Set oFF1 = Selection.FormFields.Add(Range:=Selection.Range, Type:=wdFieldFormTextInput)
With oFF1
With .TextInput
.EditType Type:=wdNumberText, Default:="", Format:=""
.Width = 1
End With
.Enabled = True
End With
ActiveDocument.Fields.Update
Selection.Find.Execute
Loop

Selection.HomeKey wdStory
sFindText = "f2"
Selection.Find.Execute sFindText
Do Until Selection.Find.Found = False
Set oFF2 = Selection.FormFields.Add(Range:=Selection.Range, Type:=wdFieldFormTextInput)
With oFF2
With .TextInput
.EditType Type:=wdNumberText, Default:="", Format:=""
.Width = 2
End With
.Enabled = True
End With
ActiveDocument.Fields.Update
Selection.Find.Execute
Loop

Selection.HomeKey wdStory
sFindText = "fx"
Selection.Find.Execute sFindText
Do Until Selection.Find.Found = False
Set oFFx = Selection.FormFields.Add(Range:=Selection.Range, Type:=wdFieldFormTextInput)
With oFFx
With .TextInput
.EditType Type:=wdRegularText, Default:="", Format:=""
End With
.Enabled = True
End With
ActiveDocument.Fields.Update
Selection.Find.Execute
Loop

End Sub
Reply With Quote
 

Tags
form field, mail merge

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to keep formatted form fields after mail merge or replace text with formatted form fields Multiple Text Fields in Form robstark Word 1 08-11-2014 11:26 AM
Spellcheck macro for protected form fields needed rharvey1215 Word 12 03-31-2014 06:47 PM
Macro to keep formatted form fields after mail merge or replace text with formatted form fields Word Form / VBA Solution for Formatted Document elmousa68 Word VBA 5 10-15-2013 05:10 PM
Macro to keep formatted form fields after mail merge or replace text with formatted form fields Form Fields - Create blank form text field with if statement? LAssist2011 Word 5 12-14-2011 03:02 PM
Insert formatted table into word (mail merge) manojbmsce Mail Merge 0 09-25-2008 02:25 AM

Other Forums: Access Forums

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