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 ....
Thanks,
Ronny