+ Reply to Thread
Results 1 to 7 of 7

Delete all data connections in Word document

  1. #1
    Registered User
    Join Date
    07-15-2015
    Location
    Brno, Czech republic
    MS-Off Ver
    2010
    Posts
    13

    Delete all data connections in Word document

    Hey girls and guys!
    I have a word file which has many graphs and tables from excel, which are connected to the word document. I am looking for a word macro that would delete all these data connections.
    Does anybody know how to solve that in Word 2010?
    Thanks, Petr

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,835

    Re: Delete all data connections in Word document

    You could use Ctrl-A, Ctrl-Shift-F9 to convert all fields to their results. If you have embedded Objects (e.g. Excel) with cells linked to external workbooks, those would have to be break those links separately.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    07-15-2015
    Location
    Brno, Czech republic
    MS-Off Ver
    2010
    Posts
    13

    Re: Delete all data connections in Word document

    Thanks, that works fine, but it kills all data connections, including tables numbering, table of contents, cross references... I just need to unlink "external" connections - only the ones from Excel, which are input (source) of data in the tables in my Word file. Do you think it's possible to kill only Excel connections?
    The macro so far looks like:
    Please Login or Register  to view this content.

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,835

    Re: Delete all data connections in Word document

    Your macro would do the same as Ctrl-A, Ctrl-Shift-F9. Try:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-15-2015
    Location
    Brno, Czech republic
    MS-Off Ver
    2010
    Posts
    13

    Re: Delete all data connections in Word document

    It keeps numbering of tables and the table of contents, that's great, but it also disconnects cross-references... would you please have any solution for that? Thank you

  6. #6
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,835

    Re: Delete all data connections in Word document

    You could try replacing:
    If Not .LinkFormat Is Nothing Then .Unlink
    with:
    If Not .OLEFormat Is Nothing Then .Unlink
    otherwise:
    If (.Type = wdFieldDatabase) Or _
    (.Type = wdFieldImport) Or _
    (.Type = wdFieldInclude) Or _
    (.Type = wdFieldIncludePicture) Or _
    (.Type = wdFieldIncludeText) Or _
    (.Type = wdFieldLink) Then .Unlink

  7. #7
    Registered User
    Join Date
    07-15-2015
    Location
    Brno, Czech republic
    MS-Off Ver
    2010
    Posts
    13

    Re: Delete all data connections in Word document

    Absolutely great thanks for your time Macropod!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Delete all Paragraph in a Word document containing a particular inlineshape using VBA
    By sshishirkumar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2015, 05:28 AM
  2. vba code to delete the empty bookmarks in Word document
    By mvneema in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2014, 08:29 AM
  3. Need to delete first 9 lines in each page in word document
    By Naveed Raza in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2014, 06:16 PM
  4. How to delete blank page in word at the end of the document
    By prithi in forum Word Formatting & General
    Replies: 4
    Last Post: 09-20-2012, 06:27 PM
  5. Cannot delete data connections
    By dpenny in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-21-2011, 05:51 PM
  6. Replies: 1
    Last Post: 06-09-2009, 03:15 PM
  7. [SOLVED] Delete all lines in word document
    By jesika in forum Word Programming / VBA / Macros
    Replies: 4
    Last Post: 02-27-2009, 11:34 PM

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