Home > Software engineering >  [for] how to use VBA in all the WORD document form to add the content of the specific name before
[for] how to use VBA in all the WORD document form to add the content of the specific name before

Time:09-19



Please write the VBA to realize the following functions:
1, the WORD document in the form of all the teacher's name, "teaching" two words, class teacher before the name "listen" two words
Original:


After add:



Appreciate!!!!!!!!!!

Why can't send attachments?

CodePudding user response:

And irregular form, document has many forms, each form has a number of irregular,
Document text, the teacher name, not in form without content, in front of the
Please post code, grateful!!!!!

CodePudding user response:

For table header line can be used to verify, then through lixia line below, with the contents of the cell

CodePudding user response:

reference 1st floor botterfleabane response:
and irregular form, document has many forms, each form has a number of irregular,
Document text, the teacher name, not in form without content, in front of the
Please post code, grateful!!!!!


So many "irregular", then treated with code very well...


Not to do the same as "artificial intelligence"???????

CodePudding user response:

In Word start recording macros, manual, complete the required function end record macros, press Alt + F11 key, check just record macro corresponding VBA code,

CodePudding user response:

Recorded the first macro, the key problem is how to position to the next to the operation of the cell, the form is irregular

CodePudding user response:

Have this inquiry and encoding time, do have completed manually,

First of all, copy a "teaching" string, and then, find the keywords "teaching", when find the header, is in the bottom of the cell in a paste,

Lectures are similar,

CodePudding user response:

Read again,
Its righteousness from now,

Repeat one thousand times,
Corresponding macro operation since now,

CodePudding user response:

Selection table, copy, open excel, paste, add a column, the formula to add words, delete the original column, stick back to the word

CodePudding user response:

For table header line can be used to verify, then through lixia line below, with the contents of the cell

CodePudding user response:

With the names in the excel zhongjian table, it should be ready, use the method of replacement cycle operation
  •  Tags:  
  • VBA
  • Related