VB script to copy values to word

  • Re: VB script to copy values to word


    I don't think that is possible. With excel it's all or nothing... when it comes to transferring data

  • Re: VB script to copy values to word


    Here's a macro I found somewhere. Perhaps it will help you on your way


    Goal: take an Excel file and convert it into a text file with a tilde as the seperator (delimiter).


    Solution:
    First off, be sure that the text file that you want to add to is already created or you'll get an error.


    Run this code from the Excel spreadsheet that you want to convert to txt (or .dat or whatever file type you need)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  • Re: VB script to copy values to word


    This is what Im having a go with, but it is not copying the cell.
    So this now copies the cell and opens a new word doc but does not copy it!


    Any ideas?


    Are attach the updated spreadsheet




    [code]
    Option Explicit

    Sub Excel_to_Word()
    Dim appWord As Word.Application

    Set appWord = New Word.Application

    appWord.Visible = True

    Range("A1:A20").Copy

    appWord.Documents.Add.Content.Paste

    End Sub [code]

  • Re: VB script to copy values to word


    This is working for me:


  • Re: VB script to copy values to word


    Hey Gollem,


    So now I can copy/paste and open a new document.


    How about if I wanted to copy to a specific place in a document, i like the idea of overwriing a pre created doc but how do i get the value in the right place? i.e. a1 should be on, line one of the word document after the word number???


    Am i barking up the wrong tree here

Participate now!

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