Hi Morgan,
It's really hard to lock Word down that tightly. Instead, save the new
document where you want it before you let the user at it.
Dim mobDoc As Word.Document
...
With mobWordApp
Set mobDoc = .Documents.Add blah blah
mobDoc.SaveAs "C:\foo\bar.doc"
.Visible = True
.WindowState = wdWindowStateMaximize
End With
>I have some code that allows me to open a new word document from a template
>i
[quoted text clipped - 16 lines]
> fairly new to ACCESS VB etc) would be most appreciated.
> Morgan
Morgan Gartland - 22 Aug 2005 15:07 GMT
Hi John
Thanks for your advice. I have just given this a go and it doesn't like the
following line have tried a few other options and still no joy.
Dim mobDoc As Word.Document
could you possibly point me in the right direction again.
Thanks
Morgan
>Hi Morgan,
>
[quoted text clipped - 15 lines]
>> fairly new to ACCESS VB etc) would be most appreciated.
>> Morgan
John Nurick - 22 Aug 2005 15:52 GMT
Hi Morgan,
If it accepts
Set mobjWordApp = New Word.Application
it's very strange that it doesn't accept
Dim mobDoc As Word.Document
Go to Tools|References (in the VB editor) and make sure that "Microsoft Word
X.X Object Model" is checked. (The X.X varies with your version of Office.)
Also, make sure that you have
Option Explicit
as the first line of the code module.
I'd probably use something like this:
Dim mobWordApp As Word.Application
Dim mobDoc As Word.Document
Set mobWordApp = New Word.Application
With mobWordApp
Set mobDoc = .Documents.Add Template:="S:\Statement .dot"
mobDoc.SaveAs "C:\foo\bar.doc"
.Visible = True
.WindowState = wdWindowStateMaximize
End With
> Hi John
>
[quoted text clipped - 28 lines]
>>> fairly new to ACCESS VB etc) would be most appreciated.
>>> Morgan