Results 1 to 5 of 5

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

Threaded View

  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
    
    End Sub
    Last edited by ShakJames; 02-26-2015 at 10:18 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [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
  2. 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
  3. transfering data from excel to word
    By miyat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2009, 03:54 AM
  4. Transfering Excel Graphs to Word
    By Jzfromltown in forum Excel General
    Replies: 8
    Last Post: 12-13-2006, 07:42 AM
  5. [SOLVED] Excel data not transfering to Word. Colums are expanded.
    By carolsue1313 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 06-24-2005, 04:05 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