Word VBA

  • Hi guys,


    Pardon me for the horrible image, mspaint is the only imaging tool avaliable in the office. I'm new to VBA and have questions regarding a word macro.


    Doc A,B and C consist of 3 sections, of which "Agenda" is one of them. When Doc C is opened, my macro is supposed to copy all the text under the "Agenda" section from Doc A,B and then paste it in the "Agenda" section in Doc C.


    Can anyone pls give me some pointers on how to write such a macro? I have been doing trial & error and reading up articles/forums on the net but to no avail.


    Your help is greatly appreciated, thanks! :) :thanx:



    [Blocked Image: http://img219.exs.cx/img219/9231/untitled7bx.jpg]

  • Re: Word VBA


    Hi


    You need to have Doc 1, 2 & 3 open for this to work.


    I typed Agenda then two carriage returns into doc1 and doc 2 then two lines of text in each.


    I'm not very good with Word but this macro does the following.


    Switches to Doc 3 finds the words Agenda and carries out two carriage returns. So that the cursor is underneath the heading.


    It then switches to Doc 1 finds the word Agenda and copies that line plus the next three into Doc 3.


    It does 2 carriage returns so that there is a space between the first agenda and the second.


    It then switches to Doc 2 finds the word Agenda and copies that line plus the next three into Doc 3.


    It means you get the word Agenda copied over twice but you can just delet that.


    It's not very pretty but it does do what you wanted.



Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!