By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 2,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

Create a new MS Word object?

P: n/a
Hello all,
In my application I have to open a predefined MS Word document. I do this
with the following code:

Dim sDatum As String
sDatum = Date
Dim sNaamschrijver As String
Dim appWord As Word.Application
Dim wrdDoc As Word.Document
Dim strFileName As String
strFileName = "MyPath\MyFile.doc"
Set appWord = New Word.Application
Set wrdDoc = appWord.Documents.Open(strFileName, ReadOnly = True)
appWord.Visible = True
sNaamschrijver = DLookup("[Volledigenaam]", "tblMwerkers", "[username] = '"
& fOSUser_Name & "'")

Then I merge in the name of the user using the variable sNaamschrijver,
along with some other variables, which all works fine.
Then the user completes the document. After that I CANNOT allow him to save
this document at his own will. It should be saved with a certain naming
convention and at a given path. Therefore I have put a button on the
document which the user has to click. I can put in the button's code the
path where it has to be saved, but not his name. My question is: is there a
way to define a new Word object before the document opens and assigning the
value of sNaamschrijver to it - and how should it be done? After that I
could just put in in the savestring of the word document. Or maybe someone
has a better idea?

Any help very much appreciated ....
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.