Help passing some parameter to Word template from Access

N

normanf

Hi there

I am wondering how I can resolve this issue.

With the below snipple of code I am calling a word
template, which after opened extracts the data it needs
from the access database, that has call word to open.

It works fine!

Now i have applied user access level security to the
database. In order to have the word template working
properly ( extracting the data from Access) I quickly
included Username, password and loaction of the secure
system mdw file. Everone can read the the password now, if
they open the word template vba.

I would like to pass the User logon name, userid and
loaction of the secure system mdw as parameter, whilst
opening the word template.( at statup)

any sugestions??

here is the current code:
'**************************************************
'myA_id = Id of record to call from word
'database and Template are in the directory / path
'mydb.name is that database that word extracts the data
from

Dim MyDB As Database, mobjWordApp As
Word.Application, MyDoc As Word.Document

Set MyDB = CurrentDb

On Error GoTo err_AuditTemplate

Const conTEMPLATE_NAME = "ATemplate.dot"

Set mobjWordApp = New Word.Application

mobjWordApp.Visible = True

Set MyDoc = mobjWordApp.Documents.Add(Template:=GetPath
(MyDB.Name, "Path") & "\" & conTEMPLATE_NAME)

MyDoc.ATemplate MyA_id, MyFull, MyDB.Name
DoEvents

mobjWordApp.Visible = True
*********************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top