Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Loss of table styles (All)

    Hi

    I have peculiar problem with 'some' document where when I 'convert' to the new template they lose their table styles. Mind you, it only happens on some document.

    The conversion process (VBA macro), copies the contents of the 'old' document and pastes it into the 'new' document plus also sets up various custom properties etc. One wouldn't expect the users to do this manually therefore we have provided a macro to do this.

    But, if I create a new document and then copy the contents from the 'old' document manually (i.e. copy & paste within WORD) then the tables retain their properties! Strange but I don't understand. Attached pictures show the carnage. The code for copy/paste in the macro *hasn't changed* for years.

    Any comments/suggestions most welcome.

    Thanks.
    Attached Images Attached Images
    Thanks.
    Robie

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Loss of table styles (All)

    I wonder whether this is a "table style" variation on the old problem that copying a paragraph in StyleX to a document that has a different definition for StyleX will result in the paragraph taking on the new formatting?

    Can you zip up and attach a couple of documents: one that has a table that copies unchanged and one that has a table that loses its formatting? Contents should of course be anonymized.

  3. #3
    WS Lounge VIP
    Join Date
    Mar 2006
    Location
    Maryland, USA
    Posts
    690
    Thanks
    17
    Thanked 66 Times in 56 Posts

    Re: Loss of table styles (All)

    If you are using table styles, perhaps they have the same name in both documents. The default in W2007 (and I would guess earlier versions) is to match the destination styles when styles conflict. So the fix is to 1) change the table style name in the source document, 2) copy the table style from the source file to the new file, or 3) modify the style in the destination to match that in the source.

    Pam
    Pam Caswell

  4. #4
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Loss of table styles (All)

    Thanks Jefferson and Pam for your input. I guess I wasn't clear enough in my opening post as regards to the problem. Let me try again. These docs are very large - full of tables.

    I have a document (docA) with large number of tables with most of them formatted as 'Table Grid' style.

    1. Now, if I *manually* take a copy of the contents of docA and paste it to docB (brand new document), the table formatting is *retained*. The docB is perfect. The tables all look good - no loss of any formatting at all.
    2. If, I run my macro (which effectively takes a copy of docA and pastes it into docB), the table with styles of 'Table Grid' lose their borders, the contents is centred etc. Table Grid as a style exists in the within the styles list. This is where I am getting lost. Tables formatted as Normal (standard single line with heading rows highlighted) *don't* lose their formatting. I can't see any difference in the table styles in both sets of documents.

    So is there a difference between manual copy/paste and VBA code copy/paste? These particular sets of documents contain a large number of tables.

    I will try and send the docs (when possible). Unfortunately, can't attach anything from the office. Will have to try over the weekend.
    Thanks.
    Robie

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Loss of table styles (All)

    Try this:

    <code>Sub PasteOriginalSourceFormatting()
    Selection.PasteAndFormat wdFormatOriginalFormatting
    End Sub</code>

Posting Permissions

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