+ Reply to Thread
Results 1 to 8 of 8

Posting table to word from excel 2007 & retain formatting - pasteobject?

  1. #1
    Forum Contributor
    Join Date
    02-08-2006
    Location
    UK
    MS-Off Ver
    2013
    Posts
    204

    Posting table to word from excel 2007 & retain formatting - pasteobject?

    Can anyone help with posting a range from Excel to word and retain formatting?

    I've got a table which I can paste OK to Word using VBA, but the format gets lost.

    I've tried pastespecial xlpasteformats, but that doesn't work.

    incidentally, it's office 2007 (my employer changed it midway programming without telling me...)
    Last edited by wonderdunder; 07-18-2011 at 06:05 AM.

  2. #2
    Forum Contributor
    Join Date
    02-08-2006
    Location
    UK
    MS-Off Ver
    2013
    Posts
    204

    Re: Posting table to word from excel 2007 & retain formatting - pasteobject?

    Anyone????

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Posting table to word from excel 2007 & retain formatting - pasteobject?

    In Excel you can use :

    Please Login or Register  to view this content.
    In Word you can use

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.



  4. #4
    Forum Contributor
    Join Date
    02-08-2006
    Location
    UK
    MS-Off Ver
    2013
    Posts
    204

    Re: Posting table to word from excel 2007 & retain formatting - pasteobject?

    Hi snb - that would not work for me as it is only one sheet that I want to put into word. I also can't have it linked as the information on the spreadsheet will change, whereas the word document needs to remain as it is (and I don't want to be messing about with disabling updates etc).

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Posting table to word from excel 2007 & retain formatting - pasteobject?

    You don't understand the code: it isn't linked.
    You can restrict the insertion using:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    02-08-2006
    Location
    UK
    MS-Off Ver
    2013
    Posts
    204

    Re: Posting table to word from excel 2007 & retain formatting - pasteobject?

    I've not made myself clear in my original post - my fault.

    The table that I want to pass to Word is in a spreadsheet that is currently open and in use.
    The table is passed via a copy and paste at a bookmark.

    All of that is done and works, but some formatting gets lost and I need to retain that formatting. Pastespecial does not seem to work.

    SNB - can that code you posted be modified so that the file is inserted at a bookmark? If so, how would that be done?

    many thanks for the assistance.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Posting table to word from excel 2007 & retain formatting - pasteobject?

    You can always store a copy of a worksheet, that can be inserted in a Word document.

    Please Login or Register  to view this content.
    If retaining formatting is a prerequisite you may need to change your mindset from 'copy' to 'insert'.
    Please dive into Word's VBEditor's helpfiles, lemma 'insertfile'.

  8. #8
    Forum Contributor
    Join Date
    02-08-2006
    Location
    UK
    MS-Off Ver
    2013
    Posts
    204

    Re: Posting table to word from excel 2007 & retain formatting - pasteobject?

    I've tried this and all I keep getting is error "5792 The file appears to be corrupt."

    I've checked the file and cannot see anything wrong. I've tried macro enabled, non-macro enabled etc etc.

    Surely there must be some way of either pasting this range and retaining the format or by pasting it as an object - (picture - anything).

+ 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