+ Reply to Thread
Results 1 to 3 of 3

Macro to open a word letter template in Excel.

  1. #1
    Registered User
    Join Date
    06-02-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Macro to open a word letter template in Excel.

    Can someone help me in writing a VB Script code to open a word letter template via macro in excel based on the conditions provided and then autofill the details required in the Word template based on the data on the same excel sheet...

    I have a code for opening a word document, but when i use it it opens a word app without any details...

    Sub Templates()
    '
    '
    '
    'Template
    '
    If Range("G6") >= 2 And Range("G13") >= Range("J13") And Range("D9") > Date Then

    Dim objWord As Object

    Set objWord = CreateObject("Word.Application")
    objWord.Visible = True

    objWord.Documents.Open "E:\Myself\RESUME\"""

    End If

    If Range("G6") >= 2 And Range("G13") >= Range("J13") And Range("D9") <= Date Then
    Range("D13") = "Letter B"
    End If

    End Sub

    Can someone please help me with this to understand how it works actually..

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388

    Re: Macro to open a word letter template in Excel.

    You haven't specified a document to open:
    Please Login or Register  to view this content.
    Also are you trying to open a document based on a template or the template (.dot file) itself?

  3. #3
    Registered User
    Join Date
    06-02-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro to open a word letter template in Excel.

    for quick reference i have attached the macro on which I'm currently working on... I have given a set of conditions to open a word letter template... but unfortunately, upon clicking the button it just opens a word application but not the document.

    @T-J : Thank you T-J, I tried as mentioned, still it didn't work at my end.

    Also I would have to get the Name and start date be uploaded onto the word document upon clicking that button... Is it possible? Do let me know...
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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