+ Reply to Thread
Results 1 to 3 of 3

Copy Table from Excel to Word thru VBA

  1. #1
    Registered User
    Join Date
    04-07-2008
    Posts
    1

    Question Copy Table from Excel to Word thru VBA

    i have a Table in excel.. i need to copy it to a selected Word Document at a Fixed Location..I am able to extract the exact location where the table is to be placed and i m also able to paste the table and format it.. but the problem arises when i re-run the same code 2nd time... this time the code shows error.. that "the remote server machine does not exist or is unavailable" wherein the word file is at my system only...

    the piece of code i have written is:
    dim word_application as word.application
    With word_application.Application
    .Selection.Paste
    .Selection.MoveUp Unit:=wdLine, Count:=CountOfRows + 1, Extend:=wdExtend
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' ERROR AREA...SOMETIMES CODE RUNS SOMETIMES HANGS.............
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    .Selection.Tables(1).Rows.LeftIndent = InchesToPoints(0.76)
    .Selection.Tables(1).PreferredWidthType = wdPreferredWidthPoints
    .Selection.Tables(1).PreferredWidth = InchesToPoints(5.56)
    end with

  2. #2
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852
    why dont you paste the table in the document as a link. Everytime you open that document, it will update with the new information.
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  3. #3
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,658
    R Agarwal, please edit your post to add code tags: http://www.excelforum.com/misc.php?do=bbcode#code

+ 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