I have read many, many posting on this subject but none come close to my
scenario, which is:

1) I have this code snuipped from an Access 2003 application that creates
documents mased on templates and inserts values from an Access table:

'Start of Code Snippet.
... (some code)

Set objWord = New Word.Application
With objWord
' open a new templat instance.
.Documents.Add Template:=(strDocPath)
' save the document in the default dir.
.ActiveDocument.SaveAs FileName:=stNewDocName,
FileFormat:=wdFormatDocument
.Documents(stNewDocName).Activate
End With

... (some code that sets the bookmarks in the document(s) to appropriate
values

With objWord
' close the document and save the change.
.Documents(stNewDocName).Close SaveChanges:=wdSaveChanges
' quit word
.Quit
End With

End of code snippet

Under Windows 2000 and Office XP this worked fine, but under Windows 2003 &
Office 2003 the .Close statement generates the "This file is in use by
another application or user" message citing Normal.Dot. I am stumped. Any
ideas?

Thanks, Brad Marshall

Re: This File is in use by another Application or User (Normal.dot) in Word 2003 by Steve

Steve
Fri Jul 02 14:12:45 CDT 2004

Hi Brad,

It sounds as if you have a hidden instance of Word running.
Before you run your code in Access:
Do a Ctrl-Alt-Del and click on the task manager button. When that appears,
click Processes and look for WinWord.exe as an image name. If there is one,
you will then have to determine which app has started the instance. It could
be any number of applications.

As a side note, I personally would add Set objWord = nothing at the end of
the code. Word is notoriously bad about cleaning up object variables if you
don't explicitly de-allocate them. I don't know if that is the situation
with Access, but it probably wouldn't hurt.

HTH and have a great day!

Steve


"Brad Marshall" <bradley.marshall@verizon.net> wrote in message
news:%23Xem2KGYEHA.3476@tk2msftngp13.phx.gbl...
> I have read many, many posting on this subject but none come close to my
> scenario, which is:
>
> 1) I have this code snuipped from an Access 2003 application that creates
> documents mased on templates and inserts values from an Access table:
>
> 'Start of Code Snippet.
> ... (some code)
>
> Set objWord = New Word.Application
> With objWord
> ' open a new templat instance.
> .Documents.Add Template:=(strDocPath)
> ' save the document in the default dir.
> .ActiveDocument.SaveAs FileName:=stNewDocName,
> FileFormat:=wdFormatDocument
> .Documents(stNewDocName).Activate
> End With
>
> ... (some code that sets the bookmarks in the document(s) to appropriate
> values
>
> With objWord
> ' close the document and save the change.
> .Documents(stNewDocName).Close SaveChanges:=wdSaveChanges
> ' quit word
> .Quit
> End With
>
> End of code snippet
>
> Under Windows 2000 and Office XP this worked fine, but under Windows 2003
&
> Office 2003 the .Close statement generates the "This file is in use by
> another application or user" message citing Normal.Dot. I am stumped.
Any
> ideas?
>
> Thanks, Brad Marshall
>
>



Re: This File is in use by another Application or User (Normal.dot) in Word 2003 by Brad

Brad
Fri Jul 02 14:23:49 CDT 2004

Hmmm, no joy, Steve - no hidden instance. And thanks for the Set objWord =
Nothing. It's there, but I didn't include it in the snippet - but one can't
be reminded of this detail too many times. SO - I'm still looking for the
answer!

Brad Marshall

"Steve Lang" <nowhere@Nohow.not> wrote in message
news:%23p4mPiGYEHA.2972@TK2MSFTNGP12.phx.gbl...
> Hi Brad,
>
> It sounds as if you have a hidden instance of Word running.
> Before you run your code in Access:
> Do a Ctrl-Alt-Del and click on the task manager button. When that appears,
> click Processes and look for WinWord.exe as an image name. If there is
one,
> you will then have to determine which app has started the instance. It
could
> be any number of applications.
>
> As a side note, I personally would add Set objWord = nothing at the end
of
> the code. Word is notoriously bad about cleaning up object variables if
you
> don't explicitly de-allocate them. I don't know if that is the situation
> with Access, but it probably wouldn't hurt.
>
> HTH and have a great day!
>
> Steve
>
>
> "Brad Marshall" <bradley.marshall@verizon.net> wrote in message
> news:%23Xem2KGYEHA.3476@tk2msftngp13.phx.gbl...
> > I have read many, many posting on this subject but none come close to my
> > scenario, which is:
> >
> > 1) I have this code snuipped from an Access 2003 application that
creates
> > documents mased on templates and inserts values from an Access table:
> >
> > 'Start of Code Snippet.
> > ... (some code)
> >
> > Set objWord = New Word.Application
> > With objWord
> > ' open a new templat instance.
> > .Documents.Add Template:=(strDocPath)
> > ' save the document in the default dir.
> > .ActiveDocument.SaveAs FileName:=stNewDocName,
> > FileFormat:=wdFormatDocument
> > .Documents(stNewDocName).Activate
> > End With
> >
> > ... (some code that sets the bookmarks in the document(s) to appropriate
> > values
> >
> > With objWord
> > ' close the document and save the change.
> > .Documents(stNewDocName).Close SaveChanges:=wdSaveChanges
> > ' quit word
> > .Quit
> > End With
> >
> > End of code snippet
> >
> > Under Windows 2000 and Office XP this worked fine, but under Windows
2003
> &
> > Office 2003 the .Close statement generates the "This file is in use by
> > another application or user" message citing Normal.Dot. I am stumped.
> Any
> > ideas?
> >
> > Thanks, Brad Marshall
> >
> >
>
>



Re: This File is in use by another Application or User (Normal.dot) in Word 2003 by Steve

Steve
Fri Jul 02 16:38:13 CDT 2004

Hi Brad,

Next thought:
Perhaps the document you created - for whatever reason - is trying to update
its source template, in this case, Normal. Try explicitly stating that the
template is not dirty by doing this:

With objWord
> > > ' close the document and save the change.
activedocument.attachedtemplate.saved = true
> > > .Documents(stNewDocName).Close SaveChanges:=wdSaveChanges
> > > ' quit word
> > > .Quit
> > > End With


Steve

"Brad Marshall" <bradley.marshall@verizon.net> wrote in message
news:OEpHaoGYEHA.1684@tk2msftngp13.phx.gbl...
> Hmmm, no joy, Steve - no hidden instance. And thanks for the Set objWord
=
> Nothing. It's there, but I didn't include it in the snippet - but one
can't
> be reminded of this detail too many times. SO - I'm still looking for the
> answer!
>
> Brad Marshall
>
> "Steve Lang" <nowhere@Nohow.not> wrote in message
> news:%23p4mPiGYEHA.2972@TK2MSFTNGP12.phx.gbl...
> > Hi Brad,
> >
> > It sounds as if you have a hidden instance of Word running.
> > Before you run your code in Access:
> > Do a Ctrl-Alt-Del and click on the task manager button. When that
appears,
> > click Processes and look for WinWord.exe as an image name. If there is
> one,
> > you will then have to determine which app has started the instance. It
> could
> > be any number of applications.
> >
> > As a side note, I personally would add Set objWord = nothing at the
end
> of
> > the code. Word is notoriously bad about cleaning up object variables if
> you
> > don't explicitly de-allocate them. I don't know if that is the situation
> > with Access, but it probably wouldn't hurt.
> >
> > HTH and have a great day!
> >
> > Steve
> >
> >
> > "Brad Marshall" <bradley.marshall@verizon.net> wrote in message
> > news:%23Xem2KGYEHA.3476@tk2msftngp13.phx.gbl...
> > > I have read many, many posting on this subject but none come close to
my
> > > scenario, which is:
> > >
> > > 1) I have this code snuipped from an Access 2003 application that
> creates
> > > documents mased on templates and inserts values from an Access table:
> > >
> > > 'Start of Code Snippet.
> > > ... (some code)
> > >
> > > Set objWord = New Word.Application
> > > With objWord
> > > ' open a new templat instance.
> > > .Documents.Add Template:=(strDocPath)
> > > ' save the document in the default dir.
> > > .ActiveDocument.SaveAs FileName:=stNewDocName,
> > > FileFormat:=wdFormatDocument
> > > .Documents(stNewDocName).Activate
> > > End With
> > >
> > > ... (some code that sets the bookmarks in the document(s) to
appropriate
> > > values
> > >
> > > With objWord
> > > ' close the document and save the change.
> > > .Documents(stNewDocName).Close SaveChanges:=wdSaveChanges
> > > ' quit word
> > > .Quit
> > > End With
> > >
> > > End of code snippet
> > >
> > > Under Windows 2000 and Office XP this worked fine, but under Windows
> 2003
> > &
> > > Office 2003 the .Close statement generates the "This file is in use by
> > > another application or user" message citing Normal.Dot. I am stumped.
> > Any
> > > ideas?
> > >
> > > Thanks, Brad Marshall
> > >
> > >
> >
> >
>
>



Re: This File is in use by another Application or User (Normal.dot) in Word 2003 by Brad

Brad
Fri Jul 02 20:01:19 CDT 2004

Success!...although I got an error message saying that this command isn't
available because no files are open, so I extrapolated on your thoughts and
put the line you suggested here:

Set objWord = New Word.Application
With objWord
' open a new templat instance.
.Documents.Add Template:=(strDocPath)
' save the document in the default dir.
activedocument.attachedtemplate.saved = true '<<<<<<<<<<<<<
.ActiveDocument.SaveAs FileName:=stNewDocName,
FileFormat:=wdFormatDocument
.Documents(stNewDocName).Activate
End With

Thank you, Steve.

Best regards, Brad Marshall

"Steve Lang" <nowhere@Nohow.not> wrote in message
news:uHkTizHYEHA.1656@TK2MSFTNGP09.phx.gbl...
> Hi Brad,
>
> Next thought:
> Perhaps the document you created - for whatever reason - is trying to
update
> its source template, in this case, Normal. Try explicitly stating that the
> template is not dirty by doing this:
>
> With objWord
> > > > ' close the document and save the change.
> activedocument.attachedtemplate.saved = true
> > > > .Documents(stNewDocName).Close SaveChanges:=wdSaveChanges
> > > > ' quit word
> > > > .Quit
> > > > End With
>
>
> Steve
>
> "Brad Marshall" <bradley.marshall@verizon.net> wrote in message
> news:OEpHaoGYEHA.1684@tk2msftngp13.phx.gbl...
> > Hmmm, no joy, Steve - no hidden instance. And thanks for the Set
objWord
> =
> > Nothing. It's there, but I didn't include it in the snippet - but one
> can't
> > be reminded of this detail too many times. SO - I'm still looking for
the
> > answer!
> >
> > Brad Marshall
> >
> > "Steve Lang" <nowhere@Nohow.not> wrote in message
> > news:%23p4mPiGYEHA.2972@TK2MSFTNGP12.phx.gbl...
> > > Hi Brad,
> > >
> > > It sounds as if you have a hidden instance of Word running.
> > > Before you run your code in Access:
> > > Do a Ctrl-Alt-Del and click on the task manager button. When that
> appears,
> > > click Processes and look for WinWord.exe as an image name. If there is
> > one,
> > > you will then have to determine which app has started the instance. It
> > could
> > > be any number of applications.
> > >
> > > As a side note, I personally would add Set objWord = nothing at the
> end
> > of
> > > the code. Word is notoriously bad about cleaning up object variables
if
> > you
> > > don't explicitly de-allocate them. I don't know if that is the
situation
> > > with Access, but it probably wouldn't hurt.
> > >
> > > HTH and have a great day!
> > >
> > > Steve
> > >
> > >
> > > "Brad Marshall" <bradley.marshall@verizon.net> wrote in message
> > > news:%23Xem2KGYEHA.3476@tk2msftngp13.phx.gbl...
> > > > I have read many, many posting on this subject but none come close
to
> my
> > > > scenario, which is:
> > > >
> > > > 1) I have this code snuipped from an Access 2003 application that
> > creates
> > > > documents mased on templates and inserts values from an Access
table:
> > > >
> > > > 'Start of Code Snippet.
> > > > ... (some code)
> > > >
> > > > Set objWord = New Word.Application
> > > > With objWord
> > > > ' open a new templat instance.
> > > > .Documents.Add Template:=(strDocPath)
> > > > ' save the document in the default dir.
> > > > .ActiveDocument.SaveAs FileName:=stNewDocName,
> > > > FileFormat:=wdFormatDocument
> > > > .Documents(stNewDocName).Activate
> > > > End With
> > > >
> > > > ... (some code that sets the bookmarks in the document(s) to
> appropriate
> > > > values
> > > >
> > > > With objWord
> > > > ' close the document and save the change.
> > > > .Documents(stNewDocName).Close SaveChanges:=wdSaveChanges
> > > > ' quit word
> > > > .Quit
> > > > End With
> > > >
> > > > End of code snippet
> > > >
> > > > Under Windows 2000 and Office XP this worked fine, but under Windows
> > 2003
> > > &
> > > > Office 2003 the .Close statement generates the "This file is in use
by
> > > > another application or user" message citing Normal.Dot. I am
stumped.
> > > Any
> > > > ideas?
> > > >
> > > > Thanks, Brad Marshall
> > > >
> > > >
> > >
> > >
> >
> >
>
>