Can I use UNC in OPEN method?

T

ThomasAJ

I have Word 2003.
It seems Word cannot handle Universal Naming Convention in the OPEN method
as applied to the Document object.

The following causes an error, "Document not found..."
Set oWordDoc = oWordApp.Documents.Open("\\computer\c\folder\word.doc")

However the following is fine.
Set oWordDoc = oWordApp.Documents.Open("C:\folder\word.doc")

Surely I must be doing something wrong.
 
T

Tom

There is a colon missing after c in \\computer\c\folder\word.doc and is
folder the shared folder name?

Tom
 
J

Jezebel

There shouldn't be a colon if it's a UNC, but you might be right about the
share name. In general, UNCs *do* work for Documents.Open.







Tom said:
There is a colon missing after c in \\computer\c\folder\word.doc and is
folder the shared folder name?

Tom
 
T

Tom

To use a UNC address your syntax needs to be in the format:

\\networkcomputername\sharedfoldername\filename

where networkcomputername is the name of the computer on the network OR its
IP address

sharedfoldername is the shared name of that folder [on the pc in question in
windows explorer right click on the required folder select share and set a
share name for that folder]

filename is the full file name of the required file i.e., in your example
word.doc

Tom


ThomasAJ said:
'folder' any folder name.
 
T

ThomasAJ

Oh I didn't realize that.
So I cannot have something like -
\\networkcomputername\c\folder1\folder2\filename
and so the "c\folder1\folder2" part MUST be a share name.

Tom said:
To use a UNC address your syntax needs to be in the format:

\\networkcomputername\sharedfoldername\filename

where networkcomputername is the name of the computer on the network OR its
IP address

sharedfoldername is the shared name of that folder [on the pc in question in
windows explorer right click on the required folder select share and set a
share name for that folder]

filename is the full file name of the required file i.e., in your example
word.doc

Tom


ThomasAJ said:
'folder' any folder name.
 
T

Tom

In the exact form of your syntax no, as c\folder as, apart from the missing
colon after c, the c drive in question is only relevant to the local pc.

As folder2 is a subfolder of folder1 you could could the format of

\\networkcomputername\sharedfoldername\filename

where folder2 is the shared folder name

Tom
ThomasAJ said:
Oh I didn't realize that.
So I cannot have something like -
\\networkcomputername\c\folder1\folder2\filename
and so the "c\folder1\folder2" part MUST be a share name.

Tom said:
To use a UNC address your syntax needs to be in the format:

\\networkcomputername\sharedfoldername\filename

where networkcomputername is the name of the computer on the network OR
its
IP address

sharedfoldername is the shared name of that folder [on the pc in question
in
windows explorer right click on the required folder select share and set
a
share name for that folder]

filename is the full file name of the required file i.e., in your example
word.doc

Tom


ThomasAJ said:
'folder' any folder name.

:

There is a colon missing after c in \\computer\c\folder\word.doc and
is
folder the shared folder name?

Tom

I have Word 2003.
It seems Word cannot handle Universal Naming Convention in the OPEN
method
as applied to the Document object.

The following causes an error, "Document not found..."
Set oWordDoc =
oWordApp.Documents.Open("\\computer\c\folder\word.doc")

However the following is fine.
Set oWordDoc = oWordApp.Documents.Open("C:\folder\word.doc")

Surely I must be doing something wrong.
 
N

nick brandwood

if c is shared, you may get away with using c$ instead of c: as suggested
before.

\\computer\c$\folder\word.doc

but I haven't checked it to see if it works.

Tom said:
In the exact form of your syntax no, as c\folder as, apart from the missing
colon after c, the c drive in question is only relevant to the local pc.

As folder2 is a subfolder of folder1 you could could the format of

\\networkcomputername\sharedfoldername\filename

where folder2 is the shared folder name

Tom
ThomasAJ said:
Oh I didn't realize that.
So I cannot have something like -
\\networkcomputername\c\folder1\folder2\filename
and so the "c\folder1\folder2" part MUST be a share name.

Tom said:
To use a UNC address your syntax needs to be in the format:

\\networkcomputername\sharedfoldername\filename

where networkcomputername is the name of the computer on the network OR
its
IP address

sharedfoldername is the shared name of that folder [on the pc in question
in
windows explorer right click on the required folder select share and set
a
share name for that folder]

filename is the full file name of the required file i.e., in your example
word.doc

Tom


'folder' any folder name.

:

There is a colon missing after c in \\computer\c\folder\word.doc and
is
folder the shared folder name?

Tom

I have Word 2003.
It seems Word cannot handle Universal Naming Convention in the OPEN
method
as applied to the Document object.

The following causes an error, "Document not found..."
Set oWordDoc =
oWordApp.Documents.Open("\\computer\c\folder\word.doc")

However the following is fine.
Set oWordDoc = oWordApp.Documents.Open("C:\folder\word.doc")

Surely I must be doing something wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top