empty form fields
empty form fields
(OP)
I'm trying to automate our price qoute sheet with a form i made with formfields in microsoft word. I have little experience with VBA and only in reference to excel. The form fields are within a three column eight row table with one form field in each cell. I would like a code that detects whether a form field Total7 is empty and if so deletes that entire row (row 8) from the table. It has been awhile sense i've done anything like this so any help would be great.
Thanks
Rory
Thanks
Rory





RE: empty form fields
dim strContents as String
strContents = formfield("Total7").text
Once you've located the form field object in the object browser, you can hit F1 to call the help, which will have code examples and show you how to address it properly in your code.
A simple If statement or a Case statement will let you set the course for if it's empty or not.
RE: empty form fields
Tables via (for example):
ActiveDocument.Tables(1).Rows(8).Delete
Cheers,
Joerd
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
RE: empty form fields
RE: empty form fields
1. Loop through the formfields (For..Each) and verify the names to see if it matches the one you're looking for.
2. Set error trapping (On Error Goto xxx), call the formfield, and handle the error if it occurs.
Let me know if you can work it out based on these suggestions.
Cheers,
Joerd
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.