+ Reply to Thread
Results 1 to 2 of 2

Merging cells in Word Table from Excel

  1. #1
    Ex949
    Guest

    Merging cells in Word Table from Excel

    Hi all.

    I'm trying to manipulate a table in MS word from a macro based in Excel
    -- I want to merge a few cells together (akin to highlighting a set of
    cells and merging). However I can't seem to successfully select a
    range of table cells to merge.

    Any suggestions?
    Thanks.


  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    hello

    you can try this macro to Merge some Cells in word table from Excel


    Sub mergeCellsInWordTable()
    'activate Microsoft Word xx.x Object Library
    Dim WordApp As Word.Application
    Dim WordDoc As Word.Document

    Set WordApp = CreateObject("word.application") 'open Word Session
    Set WordDoc = WordApp.Documents.Open("C:\myDoc1.doc") 'open Doc
    WordApp.Visible = True

    'Merge Cells(2,3) to Cells(3,5) in the first table of word document
    WordDoc.Tables(1).Cell(Row:=2, Column:=3).Merge _
    MergeTo:=WordDoc.Tables(1).Cell(Row:=3, Column:=5)

    End Sub


    michel

+ 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