Merge two word document using vb6.0
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Merge two word document using vb6.0

  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Question Merge two word document using vb6.0

    Hello ,
    I have 2 word documents. One document is the main document which has tags within it for eg ~1, ~2 ,~3 etc at different positions in the document. The Second document also has the same tags followed by text matter. This text matter of the second document should replace the corressponding tags in the first document ie the text in the second docuement should be merged into the first document at the specific positions. Is it possible to do so through vb code ?
    if possible plz send the source code to me msr_20004@rediffmail.com

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Exclamation Re: Merge two word document using vb6.0

    The purpose of this forum is to assit you with your code errors and problems.. Not to do your Codework... Also it is not likely that anyone will E_mail the source code to you, It would be posted here for others to See and comment on..

    That asside .. Two ways to do this..
    1) Have VB open the Documents in word and use a search and replace code segment to locate your tags... (Shorter code but a bit Slower)

    2) save the doc's in RTF format and have VB open them and sequentialy read the doc and do a replace there. (Faster code but longer Coding).

    Start your Project. if you have problems Post them here and we will help you...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,537

    Re: Merge two word document using vb6.0

    Hi !

    Just a hint which maybe makes work a bit less: An easy way to get most of the code done is: Use the macro function of word. then do by hand what you want to get. when finished stop macro and in most cases you get a lot of the code you need. You then only have to adapt it with the search statements as pointed out by Gremlin because macro will not do search because you are selecting the items which need to be changed by hand, so you will find some sort of 'select' statements there.


    Jonny Poet
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,770

    Re: Merge two word document using vb6.0

    Quote Originally Posted by JonnyPoet
    Just a hint which maybe makes work a bit less: An easy way to get most of the code done is: Use the macro function of word. then do by hand what you want to get. when finished stop macro and in most cases you get a lot of the code you need.
    Very good tip....

    Recording macros is a easy way to get code.. But i find that sometimes the code written by the macro recorder is veeeeerrrrrrrrryyyyyyy long. compared to my writen code.

    But it helps a lot... Gives you all the exact command layouts required....

    Gremmy..
    Last edited by GremlinSA; November 17th, 2005 at 04:00 PM. Reason: [] tags wrong Again
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,537

    Re: Merge two word document using vb6.0

    Quote Originally Posted by GremlinSA
    the macro recorder is veeeeerrrrrrrrryyyyyyy long. compared to my writen code. But it helps a lot... Gives you all the exact command layouts required....
    Gremmy..
    Yea thats TRUE, but with a bit experience you will easily be able to only use what you are need ing of all that stuff MS creates within macros and especially for a 'beginner' you get most of the commands as they are used to get your product. So you get a 'look into' the mysteries of WORD, EXCELL...
    Good Luck

    Jonny Poet
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  6. #6
    Join Date
    Jan 2010
    Posts
    24

    Re: Merge two word document using vb6.0

    Lets say we have a word template file and we need to populate the template for "n" number of records and display a single large word document , instead of "n" separate documents.

    So after creating the separate documents we need to merge them and create a single document with multiple pages.





    http://www.mindfiresolutions.com/Mer...-VBNET-872.php

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center