+ Reply to Thread
Results 1 to 6 of 6

VBA copy to word, but do not delete bookmarks

  1. #1
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    758

    VBA copy to word, but do not delete bookmarks

    Hi all,

    I currently have 2 x codes to copy data from an excel spreadsheet into a word template when a command button on a userform is selected. The two codes are to paste text and pictures.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Currently once the codes have been run and the word document is produced I save it somewhere and then if I need to do it again with different data, I have to delete the original word template and replace it with a master copy, as the bookmarks are deleted.

    Is there a way of getting around this? I.e. not deleting the bookmarks?

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: VBA copy to word, but do not delete bookmarks

    Hi chrisellis,

    Try save as (to another location or/and another name) instead of save overwrite the template. If you don't save the template during running macro, the template will be not changed.

  3. #3
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    758

    Re: VBA copy to word, but do not delete bookmarks

    Save as seems like a perfect solution. How would I go about saving as a file name as per a particular cell and then defining the location for the save?

  4. #4
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: VBA copy to word, but do not delete bookmarks

    The Procedure1 may be look like this:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    758

    Re: VBA copy to word, but do not delete bookmarks

    Thank you for your code. Although there are no issues with it, it does not work with procedure 2 as the word document is then saved as a name not recognised by procedure 2.

    I have amended the code slightly to save the word document elsewhere and then procedure 2 is able to carry on.

    However, I am looking at a way to then save the file as a particular name from procedure 2 - once everything has been saved into the document. If you understand what I mean?

  6. #6
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: VBA copy to word, but do not delete bookmarks

    I had showed to you the method to save as with specific name
    I don't know what is your problem. Please clarify.
    Note that some characters are not allowed to naming a file.

+ 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. Code to copy from excel to bookmarks in Word
    By chrisellis250 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-05-2019, 10:28 AM
  2. [SOLVED] Copy from Excel to Word Bookmarks
    By julhs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2016, 12:34 PM
  3. VBA Transfer Data From Excel to Word and Keep Bookmarks in Word Documents
    By ShakJames in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-08-2015, 05:37 AM
  4. Copy & Paste An Excel Named Ranged Into Microsoft Word Bookmarks With VBA
    By dbalani in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2015, 08:01 PM
  5. 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
  6. Copy 3- 4 named ranges from excel to Word bookmarks
    By Krex14 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2012, 04:46 PM
  7. [SOLVED] Copy from Excel to bookmarks in Word
    By ovemal@yahoo.no in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-10-2012, 12: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