Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2013, 10:11 AM
Elan05 Elan05 is offline MACRO - Insert row based on Form Field Criteria Windows 7 64bit MACRO - Insert row based on Form Field Criteria Office 2010 64bit
Novice
MACRO - Insert row based on Form Field Criteria
 
Join Date: Mar 2013
Posts: 13
Elan05 is on a distinguished road
Unhappy MACRO - Insert row based on Form Field Criteria

Hello,



I am creating a form that will be used as a letter for many salesman in my company. I created a form field in the last row of a table. Following the table is another paragraph. The form field I am referring to will be optional to fill in, it will only be used if someone needs to include a special note in the letter (most of the time this form field will remain empty). I am trying to create a macro that inserts an extra row IF the form field is populated. If the user skips over the form field without typing anything, I don't want the row to be inserted. I have tried so many different macros trying to figure this out, I was able to get some of them to insert the row on exit of the form field, but it inserted the row, whether the form field was populated or not. Can anyone help?!
Reply With Quote
  #2  
Old 03-13-2013, 09:32 PM
fumei fumei is offline MACRO - Insert row based on Form Field Criteria Windows 7 64bit MACRO - Insert row based on Form Field Criteria Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

So it is a text input formfield; and it does not matter what text is input. ANY text will make a new row.
Reply With Quote
  #3  
Old 03-14-2013, 02:42 AM
Elan05 Elan05 is offline MACRO - Insert row based on Form Field Criteria Windows 7 64bit MACRO - Insert row based on Form Field Criteria Office 2010 64bit
Novice
MACRO - Insert row based on Form Field Criteria
 
Join Date: Mar 2013
Posts: 13
Elan05 is on a distinguished road
Default

Yes, exactly!
Reply With Quote
  #4  
Old 03-22-2013, 09:28 AM
Elan05 Elan05 is offline MACRO - Insert row based on Form Field Criteria Windows 7 64bit MACRO - Insert row based on Form Field Criteria Office 2010 64bit
Novice
MACRO - Insert row based on Form Field Criteria
 
Join Date: Mar 2013
Posts: 13
Elan05 is on a distinguished road
Default

I don't think anyone ever replied back? Is this impossible to do?!
Reply With Quote
  #5  
Old 04-15-2013, 06:35 PM
fumei fumei is offline MACRO - Insert row based on Form Field Criteria Windows 7 64bit MACRO - Insert row based on Form Field Criteria Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

Try an OnExit macro like:
Code:
   
 
Sub If_Text()
Dim oTbl As Table
Set oTbl = Selection.Tables(1)
If ActiveDocument.FormFields("Text1").Result <> "" Then
   ActiveDocument.Unprotect
   oTbl.Rows.Add
   ActiveDocument.Protect _
        Type:=wdAllowOnlyFormFields, NoReset:=True
End If
End Sub
Reply With Quote
  #6  
Old 04-16-2013, 06:39 AM
Elan05 Elan05 is offline MACRO - Insert row based on Form Field Criteria Windows 7 64bit MACRO - Insert row based on Form Field Criteria Office 2010 64bit
Novice
MACRO - Insert row based on Form Field Criteria
 
Join Date: Mar 2013
Posts: 13
Elan05 is on a distinguished road
Default

YES! That worked perfectly! Thank you!
Reply With Quote
Reply

Tags
form fields, insert row, macro

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
MACRO - Insert row based on Form Field Criteria Macro to find text and replace with form field containing that text iiiiifffff Word VBA 16 06-04-2016 01:47 AM
Change values in cells based on criteria SaneMan Excel Programming 2 02-02-2012 07:58 AM
MACRO - Insert row based on Form Field Criteria Form Fields - Create blank form text field with if statement? LAssist2011 Word 5 12-14-2011 03:02 PM
Macro to populate a text form field based on dropdown selection koloa Word 0 10-20-2011 11:52 AM
MACRO - Insert row based on Form Field Criteria Word Macro That Checks a Check Box Form Field When File Print is Executed DKerne Word VBA 4 06-09-2011 11:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft