Closed Thread
Results 1 to 3 of 3

VBA code - Transfering from Excel to Word and saving the Word doucment

  1. #1
    Forum Contributor
    Join Date
    08-07-2014
    Location
    London
    MS-Off Ver
    10
    Posts
    148

    VBA code - Transfering from Excel to Word and saving the Word doucment

    Hi all,

    Me again! I have the following code, which allows me to transfer information from an excel document to a specific word document letter template, but I would also like to save the word document in a specific folder (which is named after a specific cell in excel and is differnt from the folder that the original word template is located) and give it a specific name based on cell values in the excel worksheet. The file name should be based upon information in cells B17 & C17 and location is T:\Compliance\Complaints and the folder name which is in cell G11. I've been attempting to write without much sucess, any help wold be greatly appreciated.

    Please let me know, if you need me to clarify anything

    Cheers

    "Dim objWord As Object
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Ack Complaint")
    Set objWord = CreateObject("Word.Application")
    objWord.Visible = True
    objWord.Documents.Open "T:\Compliance\Complaints\4. Template Letters\Acknowledgement Letter Shak.docx" ' change as required
    With objWord.ActiveDocument
    .Bookmarks("Bookmark1").Range.Text = ws.Range("B7").Value
    .Bookmarks("Bookmark4").Range.Text = ws.Range("F17").Value
    .Bookmarks("Bookmark2").Range.Text = ws.Range("F9").Value
    .Bookmarks("Bookmark3").Range.Text = ws.Range("J9").Value
    .Bookmarks("Bookmark5").Range.Text = ws.Range("J7").Value
    .Bookmarks("Bookmark6").Range.Text = ws.Range("F7").Value
    .Bookmarks("Bookmark7").Range.Text = ws.Range("J7").Value
    End With

    Set objWord = Nothing"

  2. #2
    Forum Moderator Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: VBA code - Transfering from Excel to Word and saving the Word doucment

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Administrator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 365 Version 2301 (Build 16012.20000) Win 11 Home 64 Bit
    Posts
    22,328

    Re: VBA code - Transfering from Excel to Word and saving the Word doucment

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Alan


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 02-27-2015, 05:17 AM
  2. [SOLVED] My MS word is not saving files after I ran a code in excel
    By VKS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2013, 12:06 AM
  3. Transfering information from Excel to Word using VBA
    By WilliamF1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2012, 03:31 AM
  4. transfering data from excel to word
    By miyat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2009, 03:54 AM
  5. Transfering Excel Graphs to Word
    By Jzfromltown in forum Excel General
    Replies: 8
    Last Post: 12-13-2006, 07:42 AM

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