Document.Open on Hidden/Read-only file

L

Lupe

I have a template that uses Documents.Add to create a new document based on a template. The VBA code in Word (Office 97/Windows 98) runs perfectly; however it gives me an error message when I run it in Word XP (Office XP/Windows XP). The error message I get is "Word failed reading from the file (my file name). Please restore the network connection or replace the floppy disk and retry." The code runs just fine in Office 97 (Windows98). Here is the VBA line that causes the error: Documents.Add Template:=sPath & "CBC1129B_Letter.dot
The template file has hidden and read-only attributes set on it so it will not be seen/used by a user because it should only be used programatically from other templates. Has anyone experienced this or have a clue why it doesn't work in Office XP/Windows XP?
 
R

RWN

Definitely not an expert, but;
Is the path name ("sPath") valid for the m/c it's running on?

--
Regards;
Rob
------------------------------------------------------------------------
Lupe said:
I have a template that uses Documents.Add to create a new document
based on a template. The VBA code in Word (Office 97/Windows 98) runs
perfectly; however it gives me an error message when I run it in Word XP
(Office XP/Windows XP). The error message I get is "Word failed reading
from the file (my file name). Please restore the network connection or
replace the floppy disk and retry." The code runs just fine in Office 97
(Windows98). Here is the VBA line that causes the error: Documents.Add
Template:=sPath & "CBC1129B_Letter.dot"
The template file has hidden and read-only attributes set on it so it
will not be seen/used by a user because it should only be used
programatically from other templates. Has anyone experienced this or
have a clue why it doesn't work in Office XP/Windows XP?
 
L

Lupe

Thanks for taking the time to question this. "sPath" is a string variable containing the network path to the template. The error says it "failed reading from the file" so I assume the file is found (otherwise I'd get a file not found error). We are in the process of converting all desktops to Office XP and Windows XP. This VBA code works in Office 97 on Windows 98. I only get the error in Office XP on Windows XP. (My subject line is not correct, I meant Document.Add)
 
R

RWN

Lupe;
I'm in *waaay* over my head here but will provide this link that I found
on Google, maybe it will offer a hint (i.e. it may
mean more to you than me);
http://lists.samba.org/archive/samba-ntdom/1998-April/000610.html

If it's a wild goose chase, I apologize.

--
Regards;
Rob
------------------------------------------------------------------------
Lupe said:
Thanks for taking the time to question this. "sPath" is a string
variable containing the network path to the template. The error says it
"failed reading from the file" so I assume the file is found (otherwise
I'd get a file not found error). We are in the process of converting
all desktops to Office XP and Windows XP. This VBA code works in Office
97 on Windows 98. I only get the error in Office XP on Windows XP. (My
subject line is not correct, I meant Document.Add)
 
L

Lupe

Rob, I read the link and I hate to admit it, but its much too technical for me. It was useful in that it hinted that it may have something to do with the administration of user rights or settings on the network folders I'm trying to access. Anyway, I'm giving up and taking it to our Network Admin people. If they find the solution, I'll post it here.
Thanks for giving it some time,
Lupe
 
L

Lupe

FYI: I was able to resolve the error by changing the Location of File settings for User templates. In our organization, all users have the Workgroup template file location pointing to a shared network folder. I had purposely changed my User template (that by default is set to the local drive) file location to point to a network folder. It seems that if both User and Workgroup templates are looking to network folders I get the error message. I changed my User templates back to the local folder and I no longer get the error message.
 
R

RWN

Lupe;
Boy, we came "that close" with the "sPath" :).

Glad you got it fixed and thanks for posting the solution, it is a good
thing to know for future reference.

--
Regards;
Rob
------------------------------------------------------------------------
Lupe said:
FYI: I was able to resolve the error by changing the Location of File
settings for User templates. In our organization, all users have the
Workgroup template file location pointing to a shared network folder. I
had purposely changed my User template (that by default is set to the
local drive) file location to point to a network folder. It seems that
if both User and Workgroup templates are looking to network folders I
get the error message. I changed my User templates back to the local
folder and I no longer get the error message.technical for me. It was useful in that it hinted that it may have
something to do with the administration of user rights or settings on
the network folders I'm trying to access. Anyway, I'm giving up and
taking it to our Network Admin people. If they find the solution, I'll
post it here.
 
Top