Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Open a word template from access database

Discussion in 'Information Technology' started by Wayne Viles, Oct 26, 2005.

  1. Wayne Viles

    Wayne Viles
    Expand Collapse
    Guest

    I ca npen a Word document but not a specific word template. How do I create
    a Command to open a word template
     
  2. Loading...


  3. Ofer

    Ofer
    Expand Collapse
    Guest

    To open a word document, create reference (while in code go to tools >
    reference) to Microsoft Word and then

    Function Open_WordDoc()

    Dim objWord As Word.Application
    Dim objDoc As Word.Document
    Dim DocPath As String

    DocPath = "Path and name of the document"

    Set objWord = New Word.Application
    Set objDoc = objWord.Documents.Open(DocPath)

    objDoc.Activate
    objDoc.PrintOut ' To print out
    objWord.Visible = True ' To display

    End Function


    --
    If I answered your question, please mark it as an answer. That way, it will
    stay saved for a longer time, so other can benifit from it.

    Good luck



    "Wayne Viles" wrote:

    > I ca npen a Word document but not a specific word template. How do I create
    > a Command to open a word template
     
  4. Wayne Viles

    Wayne Viles
    Expand Collapse
    Guest

    Beats me I'm afraid

    Current Event Procedure to open a specific Word Document is :

    Private Sub Command232_Click()
    On Error GoTo Err_Command232_Click

    Dim oApp As Object

    Set oApp = CreateObject("Word.Application")
    oApp.Documents.Open "N:\Development Control\Planning\High Hedges\Remedial
    Notice"
    oApp.Visible = True

    Exit_Command232_Click:
    Exit Sub

    Err_Command232_Click:
    MsgBox Err.Description
    Resume Exit_Command232_Click

    Can this be modified to open specific word template?

    "Ofer" wrote:

    > To open a word document, create reference (while in code go to tools >
    > reference) to Microsoft Word and then
    >
    > Function Open_WordDoc()
    >
    > Dim objWord As Word.Application
    > Dim objDoc As Word.Document
    > Dim DocPath As String
    >
    > DocPath = "Path and name of the document"
    >
    > Set objWord = New Word.Application
    > Set objDoc = objWord.Documents.Open(DocPath)
    >
    > objDoc.Activate
    > objDoc.PrintOut ' To print out
    > objWord.Visible = True ' To display
    >
    > End Function
    >
    >
    > --
    > If I answered your question, please mark it as an answer. That way, it will
    > stay saved for a longer time, so other can benifit from it.
    >
    > Good luck
    >
    >
    >
    > "Wayne Viles" wrote:
    >
    > > I ca npen a Word document but not a specific word template. How do I create
    > > a Command to open a word template
     
  5. Ofer

    Ofer
    Expand Collapse
    Guest

    Yes, where do you get the location and file name to open?

    Dim Location as String, FileName as String
    Dim oApp As Object

    Location = "c:\MyDir\"
    FileName = "MyFileName.Dot"
    Set oApp = CreateObject("Word.Application")
    oApp.Documents.Open Location & FileName
    oApp.Visible = True ' will open the document

    this code will open the file name MyFileName.Dot In the current directory
    --
    If I answered your question, please mark it as an answer. That way, it will
    stay saved for a longer time, so other can benifit from it.

    Good luck



    "Wayne Viles" wrote:

    > Beats me I'm afraid
    >
    > Current Event Procedure to open a specific Word Document is :
    >
    > Private Sub Command232_Click()
    > On Error GoTo Err_Command232_Click
    >
    > Dim oApp As Object
    >
    > Set oApp = CreateObject("Word.Application")
    > oApp.Documents.Open "N:\Development Control\Planning\High Hedges\Remedial
    > Notice"
    > oApp.Visible = True
    >
    > Exit_Command232_Click:
    > Exit Sub
    >
    > Err_Command232_Click:
    > MsgBox Err.Description
    > Resume Exit_Command232_Click
    >
    > Can this be modified to open specific word template?
    >
    > "Ofer" wrote:
    >
    > > To open a word document, create reference (while in code go to tools >
    > > reference) to Microsoft Word and then
    > >
    > > Function Open_WordDoc()
    > >
    > > Dim objWord As Word.Application
    > > Dim objDoc As Word.Document
    > > Dim DocPath As String
    > >
    > > DocPath = "Path and name of the document"
    > >
    > > Set objWord = New Word.Application
    > > Set objDoc = objWord.Documents.Open(DocPath)
    > >
    > > objDoc.Activate
    > > objDoc.PrintOut ' To print out
    > > objWord.Visible = True ' To display
    > >
    > > End Function
    > >
    > >
    > > --
    > > If I answered your question, please mark it as an answer. That way, it will
    > > stay saved for a longer time, so other can benifit from it.
    > >
    > > Good luck
    > >
    > >
    > >
    > > "Wayne Viles" wrote:
    > >
    > > > I ca npen a Word document but not a specific word template. How do I create
    > > > a Command to open a word template
     
  6. Wayne Viles

    Wayne Viles
    Expand Collapse
    Guest

    That's brilliant. Works fine. Many thanks

    "Ofer" wrote:

    > Yes, where do you get the location and file name to open?
    >
    > Dim Location as String, FileName as String
    > Dim oApp As Object
    >
    > Location = "c:\MyDir\"
    > FileName = "MyFileName.Dot"
    > Set oApp = CreateObject("Word.Application")
    > oApp.Documents.Open Location & FileName
    > oApp.Visible = True ' will open the document
    >
    > this code will open the file name MyFileName.Dot In the current directory
    > --
    > If I answered your question, please mark it as an answer. That way, it will
    > stay saved for a longer time, so other can benifit from it.
    >
    > Good luck
    >
    >
    >
    > "Wayne Viles" wrote:
    >
    > > Beats me I'm afraid
    > >
    > > Current Event Procedure to open a specific Word Document is :
    > >
    > > Private Sub Command232_Click()
    > > On Error GoTo Err_Command232_Click
    > >
    > > Dim oApp As Object
    > >
    > > Set oApp = CreateObject("Word.Application")
    > > oApp.Documents.Open "N:\Development Control\Planning\High Hedges\Remedial
    > > Notice"
    > > oApp.Visible = True
    > >
    > > Exit_Command232_Click:
    > > Exit Sub
    > >
    > > Err_Command232_Click:
    > > MsgBox Err.Description
    > > Resume Exit_Command232_Click
    > >
    > > Can this be modified to open specific word template?
    > >
    > > "Ofer" wrote:
    > >
    > > > To open a word document, create reference (while in code go to tools >
    > > > reference) to Microsoft Word and then
    > > >
    > > > Function Open_WordDoc()
    > > >
    > > > Dim objWord As Word.Application
    > > > Dim objDoc As Word.Document
    > > > Dim DocPath As String
    > > >
    > > > DocPath = "Path and name of the document"
    > > >
    > > > Set objWord = New Word.Application
    > > > Set objDoc = objWord.Documents.Open(DocPath)
    > > >
    > > > objDoc.Activate
    > > > objDoc.PrintOut ' To print out
    > > > objWord.Visible = True ' To display
    > > >
    > > > End Function
    > > >
    > > >
    > > > --
    > > > If I answered your question, please mark it as an answer. That way, it will
    > > > stay saved for a longer time, so other can benifit from it.
    > > >
    > > > Good luck
    > > >
    > > >
    > > >
    > > > "Wayne Viles" wrote:
    > > >
    > > > > I ca npen a Word document but not a specific word template. How do I create
    > > > > a Command to open a word template
     

Share This Page