CreateTextFile Error with UNC path 
Author Message
 CreateTextFile Error with UNC path

This has probably been posted & answered several times, but I'm going to ask
anyways.....

Trying the code below both ways, results in an error due to the path name...
but if I map a drive to \\computername\sharename\directory, it works just
fine.  I really don't want to map a drive on everyone's machine.  What's
wrong?  I'm writing the code with VB6 SP5 on Windows NT 4.0 SP6a with IE 5.5
SP1 and with a project reference set to the Scripting Runtime DLL.
(Everything in the path exists except for file.txt, which I'm trying to
create.)  This might matter to:  The path resides on a Unix server.  The NT
& Unix networks are connected via software from NetManage.  Thanks in
advance, -RM

---code excerpt 1-----
Dim fs as FileSystemObject
Set fs = New FileSystemObject
Dim tf As TextStream

Set tf = fs.CreateTextFile (\\computername\sharename\directory\dir\file.txt,
True)
----end excerpt 1

---- code excerpt 2-----
Dim fs as FileSystemObject
Set fs = New FileSystemObject
Dim tf As TextStream

Set tf = fs.OpenTextFile (\\computername\sharename\directory\dir\file.txt,
ForWriting, True)
----end excerpt 2------



Mon, 01 Dec 2003 08:53:13 GMT  
 CreateTextFile Error with UNC path
I haven't tested this, but at first glance I'd say you need " (quotes)
around the path.

Maybe?


Quote:
> This has probably been posted & answered several times, but I'm going to
ask
> anyways.....

> Trying the code below both ways, results in an error due to the path
name...
> but if I map a drive to \\computername\sharename\directory, it works just
> fine.  I really don't want to map a drive on everyone's machine.  What's
> wrong?  I'm writing the code with VB6 SP5 on Windows NT 4.0 SP6a with IE
5.5
> SP1 and with a project reference set to the Scripting Runtime DLL.
> (Everything in the path exists except for file.txt, which I'm trying to
> create.)  This might matter to:  The path resides on a Unix server.  The
NT
> & Unix networks are connected via software from NetManage.  Thanks in
> advance, -RM

> ---code excerpt 1-----
> Dim fs as FileSystemObject
> Set fs = New FileSystemObject
> Dim tf As TextStream

> Set tf = fs.CreateTextFile

(\\computername\sharename\directory\dir\file.txt,

- Show quoted text -

Quote:
> True)
> ----end excerpt 1

> ---- code excerpt 2-----
> Dim fs as FileSystemObject
> Set fs = New FileSystemObject
> Dim tf As TextStream

> Set tf = fs.OpenTextFile (\\computername\sharename\directory\dir\file.txt,
> ForWriting, True)
> ----end excerpt 2------



Mon, 01 Dec 2003 19:09:33 GMT  
 CreateTextFile Error with UNC path
I forgot the quotes around the path in my original post. (sorry)  The
code only works if I have a drive mapped to the same path.  I really
don't want to have a drive mapped to the path on everyone's machine.
Is there a way around this?  Am I doing something wrong, or is it a
problem with how the Unix & NT networks are connected (via the
NetManage Software)?
Quote:

> This has probably been posted & answered several times, but I'm going to ask
> anyways.....

> Trying the code below both ways, results in an error due to the path name...
> but if I map a drive to \\computername\sharename\directory, it works just
> fine.  I really don't want to map a drive on everyone's machine.  What's
> wrong?  I'm writing the code with VB6 SP5 on Windows NT 4.0 SP6a with IE 5.5
> SP1 and with a project reference set to the Scripting Runtime DLL.
> (Everything in the path exists except for file.txt, which I'm trying to
> create.)  This might matter to:  The path resides on a Unix server.  The NT
> & Unix networks are connected via software from NetManage.  Thanks in
> advance, -RM

> ---code excerpt 1-----
> Dim fs as FileSystemObject
> Set fs = New FileSystemObject
> Dim tf As TextStream

> Set tf = fs.CreateTextFile (\\computername\sharename\directory\dir\file.txt,
> True)
> ----end excerpt 1

> ---- code excerpt 2-----
> Dim fs as FileSystemObject
> Set fs = New FileSystemObject
> Dim tf As TextStream

> Set tf = fs.OpenTextFile (\\computername\sharename\directory\dir\file.txt,
> ForWriting, True)
> ----end excerpt 2------



Tue, 02 Dec 2003 01:02:44 GMT  
 CreateTextFile Error with UNC path
The problem is highly unlikely to be with FSO support for UNC paths which are fully supported.  Try
comparable test code with a network share on an NT server rather than Unix...  If that works, then
the problem most likely is with the NetManage connection...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> I forgot the quotes around the path in my original post. (sorry)  The
> code only works if I have a drive mapped to the same path.  I really
> don't want to have a drive mapped to the path on everyone's machine.
> Is there a way around this?  Am I doing something wrong, or is it a
> problem with how the Unix & NT networks are connected (via the
> NetManage Software)?




Quote:
> > This has probably been posted & answered several times, but I'm going to ask
> > anyways.....

> > Trying the code below both ways, results in an error due to the path name...
> > but if I map a drive to \\computername\sharename\directory, it works just
> > fine.  I really don't want to map a drive on everyone's machine.  What's
> > wrong?  I'm writing the code with VB6 SP5 on Windows NT 4.0 SP6a with IE 5.5
> > SP1 and with a project reference set to the Scripting Runtime DLL.
> > (Everything in the path exists except for file.txt, which I'm trying to
> > create.)  This might matter to:  The path resides on a Unix server.  The NT
> > & Unix networks are connected via software from NetManage.  Thanks in
> > advance, -RM

> > ---code excerpt 1-----
> > Dim fs as FileSystemObject
> > Set fs = New FileSystemObject
> > Dim tf As TextStream

> > Set tf = fs.CreateTextFile (\\computername\sharename\directory\dir\file.txt,
> > True)
> > ----end excerpt 1

> > ---- code excerpt 2-----
> > Dim fs as FileSystemObject
> > Set fs = New FileSystemObject
> > Dim tf As TextStream

> > Set tf = fs.OpenTextFile (\\computername\sharename\directory\dir\file.txt,
> > ForWriting, True)
> > ----end excerpt 2------



Tue, 02 Dec 2003 01:24:39 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Filesystem object UNC Path Error

2. Converting logical paths to UNC paths

3. Converting logical paths to UNC paths

4. Converting local path to UNC path?

5. CreateTextFile doesn't like the filename to be in UNC form

6. Local path vs UNC Path

7. Help converting UNC paths to physical paths.

8. How transform path into unc-path ?

9. How to convert local path to UNC-path?

10. How to convert local path to UNC-path?

11. turning a local path into a UNC path

12. How to convert path to UNC path?

 

 
Powered by phpBB® Forum Software