This is my third post on the subject; it's creating real problems for
me, I hope someone who understands the peculiarities of Word programming
will lend a hand. Strangely there is almost nothing I can find via
google on the subject.
...
How does one move the active doc; this issue is givimg all sorts of
problems. I've tried several solutions but not work reliably.

For instance, I thought I'd perform a SaveAs from within Word; that
should move the Active Document pointer or whatever it's called to the
newly saved doc; the orig doc should be closed. Then, use Kill to delete
the orig file. This approach works fine on some machines, on other
machines it fails with error 70 permission denied. The orig file is
still open on some machines (but not others). On those machines I can
see that the file exits in both locations, and the open file is the orig
file.

Why is word so inconsistent with this fundemental behavior? Via menu
choices, in all cases SaveAs moves the current file to the "new" file. I
am programming in Word 2002 and the machines that have this issue are
Word 2000 - but the saveas behavior is so basic that I can't imagine
that it's deliberately different programming this in the two versions.

I have doevents all over the place. And, if I try to close the word doc
in it's original location, I error out with "Bad File Name", when I can
see the file is still at that location.

Re: Help! 3rd request re: SaveAs problems by Howard

Howard
Mon Sep 27 18:21:38 CDT 2004

The problem you have encountered appears to a problem that's been with us
since day 1 of Windows/Office interaction.

Sometimes you can get around the problem by changing your apps logic, other
times you will not be able to get around the problem and will have to
program around the error.

The problem is caused by either Word, or Windows, not releasing the file
handle resource for a file that you believe is logically closed.
You either need to program around it, or program around the error message.

--
http://www.standards.com/; See Howard Kaikow's web site.
"kiln" <kiln@brick-like.com> wrote in message
news:MPG.1bc235d1f0a82e929898eb@msnews.microsoft.com...
> This is my third post on the subject; it's creating real problems for
> me, I hope someone who understands the peculiarities of Word programming
> will lend a hand. Strangely there is almost nothing I can find via
> google on the subject.
> ...
> How does one move the active doc; this issue is givimg all sorts of
> problems. I've tried several solutions but not work reliably.
>
> For instance, I thought I'd perform a SaveAs from within Word; that
> should move the Active Document pointer or whatever it's called to the
> newly saved doc; the orig doc should be closed. Then, use Kill to delete
> the orig file. This approach works fine on some machines, on other
> machines it fails with error 70 permission denied. The orig file is
> still open on some machines (but not others). On those machines I can
> see that the file exits in both locations, and the open file is the orig
> file.
>
> Why is word so inconsistent with this fundemental behavior? Via menu
> choices, in all cases SaveAs moves the current file to the "new" file. I
> am programming in Word 2002 and the machines that have this issue are
> Word 2000 - but the saveas behavior is so basic that I can't imagine
> that it's deliberately different programming this in the two versions.
>
> I have doevents all over the place. And, if I try to close the word doc
> in it's original location, I error out with "Bad File Name", when I can
> see the file is still at that location.



Re: Help! 3rd request re: SaveAs problems by kiln

kiln
Mon Sep 27 19:37:57 CDT 2004

I'm not sure that that is the problem. If the programmatic SaveAs is
supposed to do the same as a manual SaveAs operation, then even if the
original file was left "open", it should be closable. It's not; it's not
even recognized as being there. In addition, the primary screwup that
Word seems to exihibit is that programmatically it does not make the
file created by SaveAs the ActiveDoc; the ActiveDoc is the orginal file;
the new doc is just some file out there on the disk.

Anyways, since according to you this stupidity has been with
Office/Word/Windows since day one, and thus hundreds if not thousands
must have dealt with it, and it's not at all obvious to me to do to so,
how about a pointer to a fix instead of "program around it". Gee thanks.
And why can't I find any discussion of the issue?

In article <uxC0CjOpEHA.3592@TK2MSFTNGP14.phx.gbl>, kaikow@standards.com
says...
> The problem you have encountered appears to a problem that's been with us
> since day 1 of Windows/Office interaction.
>
> Sometimes you can get around the problem by changing your apps logic, other
> times you will not be able to get around the problem and will have to
> program around the error.
>
> The problem is caused by either Word, or Windows, not releasing the file
> handle resource for a file that you believe is logically closed.
> You either need to program around it, or program around the error message.
>
>

Re: MVP: Help! 3rd request re: SaveAs problems by Jay

Jay
Mon Sep 27 22:40:18 CDT 2004

Hi kiln,

I haven't tried it, so I don't know what gotchas you'll run into, but
I think the Name function is your tool of choice here. Close the
original document, and then run the statement

Name oldpathname As newpathname

Here's the Remarks section from the help topic on Name:

"The Name statement renames a file and moves it to a different
directory or folder, if necessary. Name can move a file across drives,
but it can only rename an existing directory or folder when both
newpathname and oldpathname are located on the same drive. Name cannot
create a new file, directory, or folder.

Using Name on an open file produces an error. You must close an open
file before renaming it. Name arguments cannot include
multiple-character (*) and single-character (?) wildcards."

--
Regards,
Jay Freedman http://aspnet2.com/mvp.ashx?JayFreedman
Microsoft Word MVP FAQ: http://word.mvps.org

kiln <kiln@brick-like.com> wrote:

>This is my third post on the subject; it's creating real problems for
>me, I hope someone who understands the peculiarities of Word programming
>will lend a hand. Strangely there is almost nothing I can find via
>google on the subject.
>...
>How does one move the active doc; this issue is givimg all sorts of
>problems. I've tried several solutions but not work reliably.
>
>For instance, I thought I'd perform a SaveAs from within Word; that
>should move the Active Document pointer or whatever it's called to the
>newly saved doc; the orig doc should be closed. Then, use Kill to delete
>the orig file. This approach works fine on some machines, on other
>machines it fails with error 70 permission denied. The orig file is
>still open on some machines (but not others). On those machines I can
>see that the file exits in both locations, and the open file is the orig
>file.
>
>Why is word so inconsistent with this fundemental behavior? Via menu
>choices, in all cases SaveAs moves the current file to the "new" file. I
>am programming in Word 2002 and the machines that have this issue are
>Word 2000 - but the saveas behavior is so basic that I can't imagine
>that it's deliberately different programming this in the two versions.
>
>I have doevents all over the place. And, if I try to close the word doc
>in it's original location, I error out with "Bad File Name", when I can
>see the file is still at that location.


Re: Help! 3rd request re: SaveAs problems by JB

JB
Tue Sep 28 06:15:46 CDT 2004

kiln wrote:
> I'm not sure that that is the problem. If the programmatic SaveAs is
> supposed to do the same as a manual SaveAs operation, then even if the
> original file was left "open", it should be closable. It's not; it's not
> even recognized as being there. In addition, the primary screwup that
> Word seems to exihibit is that programmatically it does not make the
> file created by SaveAs the ActiveDoc; the ActiveDoc is the orginal file;
> the new doc is just some file out there on the disk.
>
> Anyways, since according to you this stupidity has been with
> Office/Word/Windows since day one, and thus hundreds if not thousands
> must have dealt with it, and it's not at all obvious to me to do to so,
> how about a pointer to a fix instead of "program around it". Gee thanks.
> And why can't I find any discussion of the issue?
>
> In article <uxC0CjOpEHA.3592@TK2MSFTNGP14.phx.gbl>, kaikow@standards.com
> says...
>
>>The problem you have encountered appears to a problem that's been with us
>>since day 1 of Windows/Office interaction.
>>
>>Sometimes you can get around the problem by changing your apps logic, other
>>times you will not be able to get around the problem and will have to
>>program around the error.
>>
>>The problem is caused by either Word, or Windows, not releasing the file
>>handle resource for a file that you believe is logically closed.
>>You either need to program around it, or program around the error message.
>>
>>
Hi Kiln,
Not sure if this is exactly what you are looking for but here's some
code which might set you on your way to happy programming.

Dim MyWin As Window
Dim WinName As String
Dim TempName As String

If Application.Windows.Count > 1 Then
For Each MyWin In Application.Windows 'Loops through all
open 'windows

x = Len(MyWin.Document.Name)
WinName = Left(MyWin.Document.Name, x - 4) ' Get the document 'name

x = Len(strTempName) ' Variable for window you want to ID
TempName = Left(strTempName, x - 4)

If InStr(1, WinName, TempName, vbTextCompare) Then 'Check
window 'names match and activate then do what you will 'including
save/close then you have the var to pass to your delete 'function.

MyWin.Activate
Exit For
Else
CloseWin = False
End If
Next
End If

HTH

J


Re: Help! 3rd request re: SaveAs problems by Helmut

Helmut
Tue Sep 28 06:32:42 CDT 2004

Hi everybody,
the workaround I use is to save the file twice.
First saveas lets say "c:\invoice\009987.doc",
then save as "c:\trash\trash.doc".
After that, Word, as far as I see, has released
"c:\invoice\009987.doc" completely.
Well, remains "c:\trash\trash.doc".
A minor drawback, a drawback nevertheless.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98


Re: Help! 3rd request re: SaveAs problems by Howard

Howard
Tue Sep 28 12:18:56 CDT 2004

Ayup, that's the rub.
The cleanest way, if the app logic permits, since the app wishes to Kill the
original anyway, is to first COPY the file to the desired location, renaming
as desired. Close the original. Work on the new copy. Save changes. Delete
the original.

If that does not work, one just has to find a way to work around the problem
by redesigning the app or ignoring the error.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote in message
news:jdiil05rp1g78fvur0i85c4c0hgjevmjm2@4ax.com...
> Hi everybody,
> the workaround I use is to save the file twice.
> First saveas lets say "c:\invoice\009987.doc",
> then save as "c:\trash\trash.doc".
> After that, Word, as far as I see, has released
> "c:\invoice\009987.doc" completely.
> Well, remains "c:\trash\trash.doc".
> A minor drawback, a drawback nevertheless.
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
>



Re: MVP: Help! 3rd request re: SaveAs problems by kiln

kiln
Tue Sep 28 12:19:59 CDT 2004

Thanks I'll try that, but first, and this is something I've never
understood about word programming (how to get around it I mean), if I
Close the activedoc, then all code after that line never fires. I've
seen other Word novices ask about the same issue but don't recall if
there was a solution posed.

So essentially, if I have the users click on a custom toolbar button
that closes the active doc, and immedately tries the Name routine, it'll
never get to the Name line.

Too bad, the SaveAs behavior of word 2002 seems to work correctly; is
the broken SaveAs of Word 2000 documented? Such an essential method to
leave trashed over several service packs, I just don't get it.

In article <43nhl05n3uq3egk3ouggcv68khlkvic2bi@4ax.com>,
jay.freedman@verizon.net says...
> Hi kiln,
>
> I haven't tried it, so I don't know what gotchas you'll run into, but
> I think the Name function is your tool of choice here. Close the
> original document, and then run the statement
>
> Name oldpathname As newpathname
>
> Here's the Remarks section from the help topic on Name:
>
> "The Name statement renames a file and moves it to a different
> directory or folder, if necessary. Name can move a file across drives,
> but it can only rename an existing directory or folder when both
> newpathname and oldpathname are located on the same drive. Name cannot
> create a new file, directory, or folder.
>
> Using Name on an open file produces an error. You must close an open
> file before renaming it. Name arguments cannot include
> multiple-character (*) and single-character (?) wildcards."
>
> --
> Regards,
> Jay Freedman http://aspnet2.com/mvp.ashx?JayFreedman
> Microsoft Word MVP FAQ: http://word.mvps.org
>
> kiln <kiln@brick-like.com> wrote:
>
> >This is my third post on the subject; it's creating real problems for
> >me, I hope someone who understands the peculiarities of Word programming
> >will lend a hand. Strangely there is almost nothing I can find via
> >google on the subject.
> >...
> >How does one move the active doc; this issue is givimg all sorts of
> >problems. I've tried several solutions but not work reliably.
> >
> >For instance, I thought I'd perform a SaveAs from within Word; that
> >should move the Active Document pointer or whatever it's called to the
> >newly saved doc; the orig doc should be closed. Then, use Kill to delete
> >the orig file. This approach works fine on some machines, on other
> >machines it fails with error 70 permission denied. The orig file is
> >still open on some machines (but not others). On those machines I can
> >see that the file exits in both locations, and the open file is the orig
> >file.
> >
> >Why is word so inconsistent with this fundemental behavior? Via menu
> >choices, in all cases SaveAs moves the current file to the "new" file. I
> >am programming in Word 2002 and the machines that have this issue are
> >Word 2000 - but the saveas behavior is so basic that I can't imagine
> >that it's deliberately different programming this in the two versions.
> >

Re: Help! 3rd request re: SaveAs problems by kiln

kiln
Tue Sep 28 12:23:09 CDT 2004

I'm also not sure how that solves my issues, but thanks.

In article <eU$MCyUpEHA.2684@TK2MSFTNGP11.phx.gbl>, no@way.com says...
> kiln wrote:
> > I'm not sure that that is the problem. If the programmatic SaveAs is
> > supposed to do the same as a manual SaveAs operation, then even if the
> > original file was left "open", it should be closable. It's not; it's not
> > even recognized as being there. In addition, the primary screwup that
> > Word seems to exihibit is that programmatically it does not make the
> > file created by SaveAs the ActiveDoc; the ActiveDoc is the orginal file;
> > the new doc is just some file out there on the disk.
> >
> > Anyways, since according to you this stupidity has been with
> > Office/Word/Windows since day one, and thus hundreds if not thousands
> > must have dealt with it, and it's not at all obvious to me to do to so,
> > how about a pointer to a fix instead of "program around it". Gee thanks.
> > And why can't I find any discussion of the issue?
> >
> > In article <uxC0CjOpEHA.3592@TK2MSFTNGP14.phx.gbl>, kaikow@standards.com
> > says...
> >
> >>The problem you have encountered appears to a problem that's been with us
> >>since day 1 of Windows/Office interaction.
> >>
> >>Sometimes you can get around the problem by changing your apps logic, other
> >>times you will not be able to get around the problem and will have to
> >>program around the error.
> >>
> >>The problem is caused by either Word, or Windows, not releasing the file
> >>handle resource for a file that you believe is logically closed.
> >>You either need to program around it, or program around the error message.
> >>
> >>
> Hi Kiln,
> Not sure if this is exactly what you are looking for but here's some
> code which might set you on your way to happy programming.
>
> Dim MyWin As Window
> Dim WinName As String
> Dim TempName As String
>
> If Application.Windows.Count > 1 Then
> For Each MyWin In Application.Windows 'Loops through all
> open 'windows
>
> x = Len(MyWin.Document.Name)
> WinName = Left(MyWin.Document.Name, x - 4) ' Get the document 'name
>
> x = Len(strTempName) ' Variable for window you want to ID
> TempName = Left(strTempName, x - 4)
>
> If InStr(1, WinName, TempName, vbTextCompare) Then 'Check
> window 'names match and activate then do what you will 'including

Re: Help! 3rd request re: SaveAs problems by kiln

kiln
Tue Sep 28 12:24:39 CDT 2004

With the word 2000 installations I'm dealing with, that is exactly the
problem. The active doc remains as the orig doc; the one created by
SaveAs is released. It's the reverse of the expected behavior.

In article <jdiil05rp1g78fvur0i85c4c0hgjevmjm2@4ax.com>,
elmkqznfwvccbf@mailinator.com says...
> Hi everybody,
> the workaround I use is to save the file twice.
> First saveas lets say "c:\invoice\009987.doc",
> then save as "c:\trash\trash.doc".
> After that, Word, as far as I see, has released
> "c:\invoice\009987.doc" completely.
> Well, remains "c:\trash\trash.doc".
> A minor drawback, a drawback nevertheless.
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
>
>

Re: MVP: Help! 3rd request re: SaveAs problems by Howard

Howard
Tue Sep 28 12:27:28 CDT 2004

Another alternative is to use WordBasic.CopyFileA, but the file handle still
might not get released.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Jay Freedman" <jay.freedman@verizon.net> wrote in message
news:43nhl05n3uq3egk3ouggcv68khlkvic2bi@4ax.com...
> Hi kiln,
>
> I haven't tried it, so I don't know what gotchas you'll run into, but
> I think the Name function is your tool of choice here. Close the
> original document, and then run the statement
>
> Name oldpathname As newpathname
>
> Here's the Remarks section from the help topic on Name:
>
> "The Name statement renames a file and moves it to a different
> directory or folder, if necessary. Name can move a file across drives,
> but it can only rename an existing directory or folder when both
> newpathname and oldpathname are located on the same drive. Name cannot
> create a new file, directory, or folder.
>
> Using Name on an open file produces an error. You must close an open
> file before renaming it. Name arguments cannot include
> multiple-character (*) and single-character (?) wildcards."
>
> --
> Regards,
> Jay Freedman http://aspnet2.com/mvp.ashx?JayFreedman
> Microsoft Word MVP FAQ: http://word.mvps.org
>
> kiln <kiln@brick-like.com> wrote:
>
> >This is my third post on the subject; it's creating real problems for
> >me, I hope someone who understands the peculiarities of Word programming
> >will lend a hand. Strangely there is almost nothing I can find via
> >google on the subject.
> >...
> >How does one move the active doc; this issue is givimg all sorts of
> >problems. I've tried several solutions but not work reliably.
> >
> >For instance, I thought I'd perform a SaveAs from within Word; that
> >should move the Active Document pointer or whatever it's called to the
> >newly saved doc; the orig doc should be closed. Then, use Kill to delete
> >the orig file. This approach works fine on some machines, on other
> >machines it fails with error 70 permission denied. The orig file is
> >still open on some machines (but not others). On those machines I can
> >see that the file exits in both locations, and the open file is the orig
> >file.
> >
> >Why is word so inconsistent with this fundemental behavior? Via menu
> >choices, in all cases SaveAs moves the current file to the "new" file. I
> >am programming in Word 2002 and the machines that have this issue are
> >Word 2000 - but the saveas behavior is so basic that I can't imagine
> >that it's deliberately different programming this in the two versions.
> >
> >I have doevents all over the place. And, if I try to close the word doc
> >in it's original location, I error out with "Bad File Name", when I can
> >see the file is still at that location.
>



Re: MVP: Help! 3rd request re: SaveAs problems by Jay

Jay
Tue Sep 28 14:06:51 CDT 2004

You have to think about how Word finds the code that it executes.

- If the macro is stored in the active document and you close the document,
the code is immediately removed from memory and the macro gets killed off
immediately.

- If the macro is stored in the template you based the active document on,
and the active document is the only open document that loads that template,
then closing the document also unloads the template. Ditto.

- If the macro is stored in the template of the active document, but there
is at least one other open document based on that template, the macro will
remain in memory and (I think) executing after closing the active document.

- Finally, if the macro is stored in a global template (possibly normal.dot,
maybe another global), opening and closing documents has no effect except
that any statements involving ActiveDocument or the Selection will cause
errors. This is probably the direction you should go.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

kiln wrote:
> Thanks I'll try that, but first, and this is something I've never
> understood about word programming (how to get around it I mean), if I
> Close the activedoc, then all code after that line never fires. I've
> seen other Word novices ask about the same issue but don't recall if
> there was a solution posed.
>
> So essentially, if I have the users click on a custom toolbar button
> that closes the active doc, and immedately tries the Name routine,
> it'll never get to the Name line.
>
> Too bad, the SaveAs behavior of word 2002 seems to work correctly; is
> the broken SaveAs of Word 2000 documented? Such an essential method to
> leave trashed over several service packs, I just don't get it.
>
> In article <43nhl05n3uq3egk3ouggcv68khlkvic2bi@4ax.com>,
> jay.freedman@verizon.net says...
>> Hi kiln,
>>
>> I haven't tried it, so I don't know what gotchas you'll run into, but
>> I think the Name function is your tool of choice here. Close the
>> original document, and then run the statement
>>
>> Name oldpathname As newpathname
>>
>> Here's the Remarks section from the help topic on Name:
>>
>> "The Name statement renames a file and moves it to a different
>> directory or folder, if necessary. Name can move a file across
>> drives, but it can only rename an existing directory or folder when
>> both newpathname and oldpathname are located on the same drive. Name
>> cannot create a new file, directory, or folder.
>>
>> Using Name on an open file produces an error. You must close an open
>> file before renaming it. Name arguments cannot include
>> multiple-character (*) and single-character (?) wildcards."
>>
>> --
>> Regards,
>> Jay Freedman http://aspnet2.com/mvp.ashx?JayFreedman
>> Microsoft Word MVP FAQ: http://word.mvps.org
>>
>> kiln <kiln@brick-like.com> wrote:
>>
>>> This is my third post on the subject; it's creating real problems
>>> for me, I hope someone who understands the peculiarities of Word
>>> programming will lend a hand. Strangely there is almost nothing I
>>> can find via google on the subject.
>>> ...
>>> How does one move the active doc; this issue is givimg all sorts of
>>> problems. I've tried several solutions but not work reliably.
>>>
>>> For instance, I thought I'd perform a SaveAs from within Word; that
>>> should move the Active Document pointer or whatever it's called to
>>> the newly saved doc; the orig doc should be closed. Then, use Kill
>>> to delete the orig file. This approach works fine on some machines,
>>> on other machines it fails with error 70 permission denied. The
>>> orig file is still open on some machines (but not others). On those
>>> machines I can see that the file exits in both locations, and the
>>> open file is the orig file.
>>>
>>> Why is word so inconsistent with this fundemental behavior? Via menu
>>> choices, in all cases SaveAs moves the current file to the "new"
>>> file. I am programming in Word 2002 and the machines that have this
>>> issue are Word 2000 - but the saveas behavior is so basic that I
>>> can't imagine that it's deliberately different programming this in
>>> the two versions.



Re: MVP: Help! 3rd request re: SaveAs problems by kiln

kiln
Tue Sep 28 15:57:06 CDT 2004

Thanks Jay, that rundown is pretty helpful, I didn't know all of that.
Still not sure how to beat this, as I'm not sure a global is the ticket
here and I don't really want extraneous docs open just to have the vba I
need to be available, but this info can only help.

In article <eCQKR5YpEHA.1988@TK2MSFTNGP09.phx.gbl>,
jay.freedman@verizon.net says...
> You have to think about how Word finds the code that it executes.
>
> - If the macro is stored in the active document and you close the document,
> the code is immediately removed from memory and the macro gets killed off
> immediately.
>
> - If the macro is stored in the template you based the active document on,
> and the active document is the only open document that loads that template,
> then closing the document also unloads the template. Ditto.
>
> - If the macro is stored in the template of the active document, but there
> is at least one other open document based on that template, the macro will
> remain in memory and (I think) executing after closing the active document.
>
> - Finally, if the macro is stored in a global template (possibly normal.dot,
> maybe another global), opening and closing documents has no effect except
> that any statements involving ActiveDocument or the Selection will cause
> errors. This is probably the direction you should go.
>
>

Re: MVP: Help! 3rd request re: SaveAs problems by Howard

Howard
Tue Sep 28 16:35:48 CDT 2004

The problem is in every version of Word.
It just shows up differently, or not, depending on the OS/file system and
the way the app is coded.

The problem is due to an inherent design issue in Word dealing with the file
system.
Sometimes one cannot program around the problem, so you are forced to use
error handling to bypass the error and cleanup after the code finishes,
sometimes requiring one to first shut down Word.

--
http://www.standards.com/; See Howard Kaikow's web site.
"kiln" <kiln@brick-like.com> wrote in message
news:MPG.1bc33d18332223e79898ed@msnews.microsoft.com...
> Thanks I'll try that, but first, and this is something I've never
> understood about word programming (how to get around it I mean), if I
> Close the activedoc, then all code after that line never fires. I've
> seen other Word novices ask about the same issue but don't recall if
> there was a solution posed.
>
> So essentially, if I have the users click on a custom toolbar button
> that closes the active doc, and immedately tries the Name routine, it'll
> never get to the Name line.
>
> Too bad, the SaveAs behavior of word 2002 seems to work correctly; is
> the broken SaveAs of Word 2000 documented? Such an essential method to
> leave trashed over several service packs, I just don't get it.
>
> In article <43nhl05n3uq3egk3ouggcv68khlkvic2bi@4ax.com>,
> jay.freedman@verizon.net says...
> > Hi kiln,
> >
> > I haven't tried it, so I don't know what gotchas you'll run into, but
> > I think the Name function is your tool of choice here. Close the
> > original document, and then run the statement
> >
> > Name oldpathname As newpathname
> >
> > Here's the Remarks section from the help topic on Name:
> >
> > "The Name statement renames a file and moves it to a different
> > directory or folder, if necessary. Name can move a file across drives,
> > but it can only rename an existing directory or folder when both
> > newpathname and oldpathname are located on the same drive. Name cannot
> > create a new file, directory, or folder.
> >
> > Using Name on an open file produces an error. You must close an open
> > file before renaming it. Name arguments cannot include
> > multiple-character (*) and single-character (?) wildcards."
> >
> > --
> > Regards,
> > Jay Freedman http://aspnet2.com/mvp.ashx?JayFreedman
> > Microsoft Word MVP FAQ: http://word.mvps.org
> >
> > kiln <kiln@brick-like.com> wrote:
> >
> > >This is my third post on the subject; it's creating real problems for
> > >me, I hope someone who understands the peculiarities of Word
programming
> > >will lend a hand. Strangely there is almost nothing I can find via
> > >google on the subject.
> > >...
> > >How does one move the active doc; this issue is givimg all sorts of
> > >problems. I've tried several solutions but not work reliably.
> > >
> > >For instance, I thought I'd perform a SaveAs from within Word; that
> > >should move the Active Document pointer or whatever it's called to the
> > >newly saved doc; the orig doc should be closed. Then, use Kill to
delete
> > >the orig file. This approach works fine on some machines, on other
> > >machines it fails with error 70 permission denied. The orig file is
> > >still open on some machines (but not others). On those machines I can
> > >see that the file exits in both locations, and the open file is the
orig
> > >file.
> > >
> > >Why is word so inconsistent with this fundemental behavior? Via menu
> > >choices, in all cases SaveAs moves the current file to the "new" file.
I
> > >am programming in Word 2002 and the machines that have this issue are
> > >Word 2000 - but the saveas behavior is so basic that I can't imagine
> > >that it's deliberately different programming this in the two versions.
> > >