Moving a File 
Author Message
 Moving a File

I am trying to move a file. The code below doesn't work, although it's
almost verbatim from VB Help. I get a "Run-time error '438' Object does
not support this method." Any ideas as to what I am doing wrong? Here's
the code. Thanks.

    Dim FileSys, MailFile

    Set FileSys = CreateObject("Scripting.FileSystemObject")
    Set MailFile = FileSys.CreateTextFile("c:\winnt\vbtestmail.eml",
True)
    MailFile.Close

    ' Move the mail file.
    MailFile.Move "c:\inetpub\mailroot\pickup"
--
Jon L. Heal



Sat, 04 Aug 2001 03:00:00 GMT  
 Moving a File
Try....

Private Sub Command1_Click()
Dim FileSys As FileSystemObject, MailTextStr As TextStream, MailFile As File

    Set FileSys = CreateObject("Scripting.FileSystemObject")
    Set MailTextStr = FileSys.CreateTextFile("c:\junk\vbtestmail.eml", True)
    MailTextStr.Close
    ' Move the mail file.
    Set MailFile = FileSys.GetFile("c:\junk\vbtestmail.eml")
    MailFile.Move "c:\"

End Sub

Quote:

>I am trying to move a file. The code below doesn't work, although it's
>almost verbatim from VB Help. I get a "Run-time error '438' Object does
>not support this method." Any ideas as to what I am doing wrong? Here's
>the code. Thanks.

>    Dim FileSys, MailFile

>    Set FileSys = CreateObject("Scripting.FileSystemObject")
>    Set MailFile = FileSys.CreateTextFile("c:\winnt\vbtestmail.eml",
>True)
>    MailFile.Close

>    ' Move the mail file.
>    MailFile.Move "c:\inetpub\mailroot\pickup"
>--
>Jon L. Heal




Sat, 04 Aug 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Moving Files Files to a DirListBox Folder with Drag and Drop

2. move a file

3. Need VBA Code to move a file after it has finished with it

4. Error in VBA script after moving pst file (newbie here)

5. Macro to Move a file to a new location

6. How do I move data file from Server to Client

7. How to prevent error while moving a file between directory

8. Help: Moving project files between PC's?

9. Move a File

10. Moving text files - VB6

11. Moving a file to a certain directory

12. moving vb files

 

 
Powered by phpBB® Forum Software