On Error Resume Next 'mistake to continue to the Next line of code
The Set wordapp=New Word. Application instantiation
'Wordapp. Documents. Open the App. The Path & amp; "Data \ \ templates. Doc"
Wordapp. Visible=False 'display Office Word interface
Wordapp. DisplayAlerts=False 'don't prompt save dialog
Wordapp. Selection. The Find. ClearFormatting
Wordapp. Selection. The Find. Replacement. ClearFormatting
Wordapp. ActiveDocument. Tables (14). The Cell (2, 2) Range. InsertAfter "test results"
* on one line of code that is inserted to the cell specified form content *
With wordapp. Selection. Find
. The Text="" test", "
. Replacement. Text=""
The Forward=True
The Wrap=wdFindContinue
. The Format=False
The MatchCase=False
. MatchWholeWord=False
. MatchByte=True
. MatchWildcards=False
. MatchSoundsLike=False
. MatchAllWordForms=False
End With
Wordapp. Selection. The Find. Execute the Replace:=wdReplaceAll
MsgBox ActiveDocument. Tables. Total Count 'access to the file form
ActiveDocument. SaveAs "c: \ MyWord. Doc" the word 'save the last article
On the Error Resume Next
Wordapp. Quit
The Set wordapp=Nothing
MsgBox "generate success",, ""
I have a lot of tables in the word how do I locate one
The table in a table with 14 digital position I would do you have any other way
Prevention after word change will affect the form number for each table can have a title according to the above judgment and then positioning or what tag or what better way to give advice or comments please
CodePudding user response:
Start recording macros in the Word 2003, manual, complete the required function end record macros, press Alt + F11 key, check just record macro corresponding VBA code,CodePudding user response:
I think on the top of the table is not actually have any name of the table, the table is set to the name of the bookmark, this is not the same as the table name, bookmarks content is different, testing the bookmarks, to locate the specific forms, is the form of the name should be the same, for example bookmark names are: nameCodePudding user response: