+ Reply to Thread
Results 1 to 4 of 4

Automation of Excel Data to Word (ref: Galimi answers)

  1. #1
    Adam
    Guest

    Automation of Excel Data to Word (ref: Galimi answers)

    I have had great help with Galimi for this process (as I am still learning
    VBA). I do not quite understand this code:

    Sub moveToWord()
    Set x = CreateObject("Word.Application")
    x.Documents.Add
    x.Visible = True

    For Each cl In Selection

    z = z & cstr(cl.value)

    Next
    x.Selection.TypeText CStr(z)

    End Sub


    What does the Z represent? Also, I need to not select everything in the
    worksheet, I just need to get portion of the data. So it is not every cell.
    How do I pre-define a selection?/

    Thanks

  2. #2
    Bob Phillips
    Guest

    Re: Automation of Excel Data to Word (ref: Galimi answers)

    z is just a variable that the cell values are being concatenated into.

    Sub moveToWord()
    Set x = CreateObject("Word.Application")
    x.Documents.Add
    x.Visible = True

    For Each cl In Range("A1:H10")

    z = z & cstr(cl.value)

    Next
    x.Selection.TypeText CStr(z)

    End Sub

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Adam" <[email protected]> wrote in message
    news:[email protected]...
    > I have had great help with Galimi for this process (as I am still learning
    > VBA). I do not quite understand this code:
    >
    > Sub moveToWord()
    > Set x = CreateObject("Word.Application")
    > x.Documents.Add
    > x.Visible = True
    >
    > For Each cl In Selection
    >
    > z = z & cstr(cl.value)
    >
    > Next
    > x.Selection.TypeText CStr(z)
    >
    > End Sub
    >
    >
    > What does the Z represent? Also, I need to not select everything in the
    > worksheet, I just need to get portion of the data. So it is not every

    cell.
    > How do I pre-define a selection?/
    >
    > Thanks




  3. #3
    Adam
    Guest

    Re: Automation of Excel Data to Word (ref: Galimi answers)

    So if it's a sporactic amount of ranges then I just state:
    ("A1,B2,C10...etc") correct? Is there also a method not to take the reference
    formula from it?There are a few cells that refer a calculation to another
    sheet, and it takes information from those cells.

    "Bob Phillips" wrote:

    > z is just a variable that the cell values are being concatenated into.
    >
    > Sub moveToWord()
    > Set x = CreateObject("Word.Application")
    > x.Documents.Add
    > x.Visible = True
    >
    > For Each cl In Range("A1:H10")
    >
    > z = z & cstr(cl.value)
    >
    > Next
    > x.Selection.TypeText CStr(z)
    >
    > End Sub
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Adam" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have had great help with Galimi for this process (as I am still learning
    > > VBA). I do not quite understand this code:
    > >
    > > Sub moveToWord()
    > > Set x = CreateObject("Word.Application")
    > > x.Documents.Add
    > > x.Visible = True
    > >
    > > For Each cl In Selection
    > >
    > > z = z & cstr(cl.value)
    > >
    > > Next
    > > x.Selection.TypeText CStr(z)
    > >
    > > End Sub
    > >
    > >
    > > What does the Z represent? Also, I need to not select everything in the
    > > worksheet, I just need to get portion of the data. So it is not every

    > cell.
    > > How do I pre-define a selection?/
    > >
    > > Thanks

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: Automation of Excel Data to Word (ref: Galimi answers)

    Non-contiguous cells are stated as you show.

    Don't really understand the second part. If it refers to another cell, you
    would still use that first cell, would you not?

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Adam" <[email protected]> wrote in message
    news:[email protected]...
    > So if it's a sporactic amount of ranges then I just state:
    > ("A1,B2,C10...etc") correct? Is there also a method not to take the

    reference
    > formula from it?There are a few cells that refer a calculation to another
    > sheet, and it takes information from those cells.
    >
    > "Bob Phillips" wrote:
    >
    > > z is just a variable that the cell values are being concatenated into.
    > >
    > > Sub moveToWord()
    > > Set x = CreateObject("Word.Application")
    > > x.Documents.Add
    > > x.Visible = True
    > >
    > > For Each cl In Range("A1:H10")
    > >
    > > z = z & cstr(cl.value)
    > >
    > > Next
    > > x.Selection.TypeText CStr(z)
    > >
    > > End Sub
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Adam" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I have had great help with Galimi for this process (as I am still

    learning
    > > > VBA). I do not quite understand this code:
    > > >
    > > > Sub moveToWord()
    > > > Set x = CreateObject("Word.Application")
    > > > x.Documents.Add
    > > > x.Visible = True
    > > >
    > > > For Each cl In Selection
    > > >
    > > > z = z & cstr(cl.value)
    > > >
    > > > Next
    > > > x.Selection.TypeText CStr(z)
    > > >
    > > > End Sub
    > > >
    > > >
    > > > What does the Z represent? Also, I need to not select everything in

    the
    > > > worksheet, I just need to get portion of the data. So it is not every

    > > cell.
    > > > How do I pre-define a selection?/
    > > >
    > > > Thanks

    > >
    > >
    > >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1