Results 1 to 3 of 3

Thread: appending files?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    11

    Question

    Is there any way to append MS Word files together through VB? I've tried:

    Open "c:\word.doc" For Append As #1
    Open "c:\part1.doc" For Input As #2
    Open "c:\part2.doc" For Output As #3

    Do Until EOF(2)
    Line Input 2, Z$
    Print #1, Z$
    Loop

    Do Until EOF(3)
    Line Input 3, Z$
    Print #1, Z$
    Loop


    But all that is produced is garbage. Any ideas?

  2. #2
    Guest
    you cant just do it like that, because of all the formatting characters and crap like that.
    use a macro in VBA to do what your trying to achieve.

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    join them binary:

    Code:
    Dim Temp() as Byte
    Dim FileNumber as Integer
    
    FileNumber = FreeFile
    Open SourceFile for Binary as FileNumber
       ReDim Temp(LOF(FileNuber))
    
       Get FileNumber,, Temp
    Close FileNumber
    
    FileNumber = FreeFile
    Open DestFile for Binary as FileNumber
       Putt FileNumber, LOF(FileNumber), Temp
    Close FileNumber
    Something like this...

Posting Permissions

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



Click Here to Expand Forum to Full Width