+ Reply to Thread
Results 1 to 4 of 4

VBA for exporting a worksheet to Word document?

  1. #1
    Registered User
    Join Date
    04-15-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    10

    VBA for exporting a worksheet to Word document?

    I have the following code that allows me to open a new Word document from Excel:

    Sub createnewWordDocument()
    Dim msWordApp As Word.Application
    Dim doc As Word.document
    Dim i As Integer

    Set msWordApp = CreateObject("Word.Application")
    msWordApp.Visible = True

    Set doc = msWordApp.Documents.Add

    With doc
    For i = 1 To 100
    .Content.InsertAfter "test line" & i
    Next i

    End With

    End Sub

    If I wanted to insert "Worksheet1" into the Word document in table format, how would I do that?

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VBA for exporting a worksheet to Word document?

    May I suggest posting your Excel related question in the Excel Programming forum instead of this Access Programming forum.
    And it would be best if you add code tags around your code as per the forum rules.

  3. #3
    Registered User
    Join Date
    04-15-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: VBA for exporting a worksheet to Word document?

    My bad. I thought I was in the Excel Programming forum.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: VBA for exporting a worksheet to Word document?

    To any mods finding this - the OP has started a new thread in Excel Programming:
    http://www.excelforum.com/excel-prog...-with-vba.html

+ 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