Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Filecopy and UNC-pathname

Hi,

I discovered that it is not possible to use the FileCopy statement in
junction with a UNC pathname.

eg. FileCopy "C:\TEMP\Test.xls", "F:\LibraData\Test.xls" works fine
FileCopy "C:\TEMP\Test.xls", "\\Acer01\LibraData\Test.xls" don't works. I
get the error message: 75 cannot access... however, LibraData is shared on
my computer with the name Acer01.

How can I solve this (I don't know on which drive the user has placed his
data). Is it possible to get the local pathname out of the shared UNC
pathname (so that \\Acer01\ is translated to eg. F:\) or is there an
alternative for the FileCopy statement?

Thanks
Jos Vens


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Filecopy and UNC-pathname

Jos,

I am confused. I assume that F is the local mapped drive letter? If so, why
are you using the UNC, why not just use the mapped drive letter?

As to the question, Randy Birch shows how to enumerate local network
resources, but this takes a lot of code, and maybe is overkill for you.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jos Vens" wrote in message
...
Hi,

I discovered that it is not possible to use the FileCopy statement in
junction with a UNC pathname.

eg. FileCopy "C:\TEMP\Test.xls", "F:\LibraData\Test.xls" works fine
FileCopy "C:\TEMP\Test.xls", "\\Acer01\LibraData\Test.xls" don't works. I
get the error message: 75 cannot access... however, LibraData is shared on
my computer with the name Acer01.

How can I solve this (I don't know on which drive the user has placed his
data). Is it possible to get the local pathname out of the shared UNC
pathname (so that \\Acer01\ is translated to eg. F:\) or is there an
alternative for the FileCopy statement?

Thanks
Jos Vens




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Filecopy and UNC-pathname

Hi Bob,

F is the logical drive (partition of my harddisk), not a mapped drive.
Maybe there is a solution to use a mapped drive letter in stead of a
UNC-path.

The reason for using a unc-path is that it can be perfectly done within VBA
(with an API-call - if it is possible to make a mapped drive in VBA, it's ok
for me) and the user can put the data whereever he wants, the program (which
is in C:\Program Files) is an addin (.xla) and finds the data, even over the
network.

However, copying new data to the user's datafolder (with UNC - it's the
destination folder that must be with a drive letter, not \\) gives an error
message.

Can you help me further?

Thanks
Jos Vens

"Bob Phillips" schreef in bericht
...
Jos,

I am confused. I assume that F is the local mapped drive letter? If so,

why
are you using the UNC, why not just use the mapped drive letter?

As to the question, Randy Birch shows how to enumerate local network
resources, but this takes a lot of code, and maybe is overkill for you.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jos Vens" wrote in message
...
Hi,

I discovered that it is not possible to use the FileCopy statement in
junction with a UNC pathname.

eg. FileCopy "C:\TEMP\Test.xls", "F:\LibraData\Test.xls" works fine
FileCopy "C:\TEMP\Test.xls", "\\Acer01\LibraData\Test.xls" don't works.

I
get the error message: 75 cannot access... however, LibraData is shared

on
my computer with the name Acer01.

How can I solve this (I don't know on which drive the user has placed

his
data). Is it possible to get the local pathname out of the shared UNC
pathname (so that \\Acer01\ is translated to eg. F:\) or is there an
alternative for the FileCopy statement?

Thanks
Jos Vens






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Filecopy and UNC-pathname

I have found the same need. There is somewhat of a work around. You can
create a hyperlink in a workbook (either manually or by VBA) that uses a
UNC. Then you can follow that hyperlink from within VBA using
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True.

Tom


"Jos Vens" wrote in message
...
Hi Bob,

F is the logical drive (partition of my harddisk), not a mapped drive.
Maybe there is a solution to use a mapped drive letter in stead of a
UNC-path.

The reason for using a unc-path is that it can be perfectly done within

VBA
(with an API-call - if it is possible to make a mapped drive in VBA, it's

ok
for me) and the user can put the data whereever he wants, the program

(which
is in C:\Program Files) is an addin (.xla) and finds the data, even over

the
network.

However, copying new data to the user's datafolder (with UNC - it's the
destination folder that must be with a drive letter, not \\) gives an

error
message.

Can you help me further?

Thanks
Jos Vens

"Bob Phillips" schreef in bericht
...
Jos,

I am confused. I assume that F is the local mapped drive letter? If so,

why
are you using the UNC, why not just use the mapped drive letter?

As to the question, Randy Birch shows how to enumerate local network
resources, but this takes a lot of code, and maybe is overkill for you.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jos Vens" wrote in message
...
Hi,

I discovered that it is not possible to use the FileCopy statement in
junction with a UNC pathname.

eg. FileCopy "C:\TEMP\Test.xls", "F:\LibraData\Test.xls" works fine
FileCopy "C:\TEMP\Test.xls", "\\Acer01\LibraData\Test.xls" don't

works.
I
get the error message: 75 cannot access... however, LibraData is

shared
on
my computer with the name Acer01.

How can I solve this (I don't know on which drive the user has placed

his
data). Is it possible to get the local pathname out of the shared UNC
pathname (so that \\Acer01\ is translated to eg. F:\) or is there an
alternative for the FileCopy statement?

Thanks
Jos Vens








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Filecopy and UNC-pathname

Hi Tom,

nice try, but I think it doesn't bring me any further: the folow method is a
sub, not a function, so it gives me no result. I tried this

In my workbook, I write the UNC-pathname in the activecell. Then in the
command window I do this:

Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
?activeworkbook.FullName
\\Acer01\LibraData\Data\0304\Versie.xls

So I thought, let me open a workbook on that place and look for the
pathname, but it is also UNC!

Can anyone help or am I missing something of your explanation? Let's repeat
my question: I want to copy a file from folder1 to folder2, but the path of
folder2 is an UNC-path (folder1 to but thats no problem for the procedure)

FileCopy \\Computer\Folder1\File.xls, \\Computer\Folder2\File.xls

If I replace \\Computer\Folder2\File.xls with C:\Folder2\File.xls,
everything works fine. However, I don't know where my customer has placed
Folder2, I certainly do know the shared name.

Thanks
Jos



"Tom Rollins" schreef in bericht
...
I have found the same need. There is somewhat of a work around. You can
create a hyperlink in a workbook (either manually or by VBA) that uses a
UNC. Then you can follow that hyperlink from within VBA using
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True.

Tom


"Jos Vens" wrote in message
...
Hi Bob,

F is the logical drive (partition of my harddisk), not a mapped drive.
Maybe there is a solution to use a mapped drive letter in stead of a
UNC-path.

The reason for using a unc-path is that it can be perfectly done within

VBA
(with an API-call - if it is possible to make a mapped drive in VBA,

it's
ok
for me) and the user can put the data whereever he wants, the program

(which
is in C:\Program Files) is an addin (.xla) and finds the data, even over

the
network.

However, copying new data to the user's datafolder (with UNC - it's the
destination folder that must be with a drive letter, not \\) gives an

error
message.

Can you help me further?

Thanks
Jos Vens

"Bob Phillips" schreef in bericht
...
Jos,

I am confused. I assume that F is the local mapped drive letter? If

so,
why
are you using the UNC, why not just use the mapped drive letter?

As to the question, Randy Birch shows how to enumerate local network
resources, but this takes a lot of code, and maybe is overkill for

you.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jos Vens" wrote in message
...
Hi,

I discovered that it is not possible to use the FileCopy statement

in
junction with a UNC pathname.

eg. FileCopy "C:\TEMP\Test.xls", "F:\LibraData\Test.xls" works fine
FileCopy "C:\TEMP\Test.xls", "\\Acer01\LibraData\Test.xls" don't

works.
I
get the error message: 75 cannot access... however, LibraData is

shared
on
my computer with the name Acer01.

How can I solve this (I don't know on which drive the user has

placed
his
data). Is it possible to get the local pathname out of the shared

UNC
pathname (so that \\Acer01\ is translated to eg. F:\) or is there an
alternative for the FileCopy statement?

Thanks
Jos Vens












  #6   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Filecopy and UNC-pathname

Hi Jos,

I don't believe filecopy works with UNC paths.
You can map the UNC path to a drive letter on the fly with MyDrive=shell (net use...)
Then you can do...
FileCopy "C:\TEMP\Test.xls", MyDrive & "\Test.xls"

And it would be nice to have the option to kill the mapping on exit.


See some other info here. http://www.google.com/groups?hl=en&l...r%3D%26hl%3Den

As far as not knowing what drive the user is using for the data, make them browse to the folder and store it as a variable.

--
John
johnf 202 at hotmail dot com


"Jos Vens" wrote in message ...
| Hi,
|
| I discovered that it is not possible to use the FileCopy statement in
| junction with a UNC pathname.
|
| eg. FileCopy "C:\TEMP\Test.xls", "F:\LibraData\Test.xls" works fine
| FileCopy "C:\TEMP\Test.xls", "\\Acer01\LibraData\Test.xls" don't works. I
| get the error message: 75 cannot access... however, LibraData is shared on
| my computer with the name Acer01.
|
| How can I solve this (I don't know on which drive the user has placed his
| data). Is it possible to get the local pathname out of the shared UNC
| pathname (so that \\Acer01\ is translated to eg. F:\) or is there an
| alternative for the FileCopy statement?
|
| Thanks
| Jos Vens
|
|
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Filecopy and UNC-pathname

Hi John,

I tried this but it doesn't work! The problem is that the path of the
mapped drive eg. Q is \\Acer01\Folder2\ (I only know the UNC-path). If I
Filecopy to Q, I get the same error message as if I should copy directly to
the UNC-path.

It's a nice suggestion with net use. I suppose you can kill the mapping
with net use Q without a path.

Thanks anyway
Jos

"jaf" schreef in bericht
...
Hi Jos,

I don't believe filecopy works with UNC paths.
You can map the UNC path to a drive letter on the fly with MyDrive=shell
(net use...)
Then you can do...
FileCopy "C:\TEMP\Test.xls", MyDrive & "\Test.xls"

And it would be nice to have the option to kill the mapping on exit.


See some other info here.
http://www.google.com/groups?hl=en&l...r%3D%26hl%3Den

As far as not knowing what drive the user is using for the data, make them
browse to the folder and store it as a variable.

--
John
johnf 202 at hotmail dot com


"Jos Vens" wrote in message
...
| Hi,
|
| I discovered that it is not possible to use the FileCopy statement in
| junction with a UNC pathname.
|
| eg. FileCopy "C:\TEMP\Test.xls", "F:\LibraData\Test.xls" works fine
| FileCopy "C:\TEMP\Test.xls", "\\Acer01\LibraData\Test.xls" don't works. I
| get the error message: 75 cannot access... however, LibraData is shared on
| my computer with the name Acer01.
|
| How can I solve this (I don't know on which drive the user has placed his
| data). Is it possible to get the local pathname out of the shared UNC
| pathname (so that \\Acer01\ is translated to eg. F:\) or is there an
| alternative for the FileCopy statement?
|
| Thanks
| Jos Vens
|
|


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Filecopy and UNC-pathname

Shame on me!!!

Filecopy does work with UNC-path's but my shared folder gave me not enough
rights to write to that folder (there are 2 types of rights: the user rights
and the share rights) It were the latter that troubled my view...

Sorry for the problem and thanks for all who gave the best of theirselves!

Jos


"Jos Vens" schreef in bericht
...
Hi,

I discovered that it is not possible to use the FileCopy statement in
junction with a UNC pathname.

eg. FileCopy "C:\TEMP\Test.xls", "F:\LibraData\Test.xls" works fine
FileCopy "C:\TEMP\Test.xls", "\\Acer01\LibraData\Test.xls" don't works. I
get the error message: 75 cannot access... however, LibraData is shared on
my computer with the name Acer01.

How can I solve this (I don't know on which drive the user has placed his
data). Is it possible to get the local pathname out of the shared UNC
pathname (so that \\Acer01\ is translated to eg. F:\) or is there an
alternative for the FileCopy statement?

Thanks
Jos Vens




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filecopy in vba macro Jodie[_2_] Excel Programming 2 September 5th 03 11:19 PM
Filecopy in vba macro Jodie[_2_] Excel Programming 0 September 5th 03 03:17 PM
FileCopy Dana DeLouis[_5_] Excel Programming 0 August 11th 03 12:57 PM
FileCopy John Green[_2_] Excel Programming 1 August 5th 03 08:55 AM
LoadPicture Pathname or no Pathname Philipp Schramek Excel Programming 1 July 8th 03 03:30 PM


All times are GMT +1. The time now is 08:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"