+ Reply to Thread
Results 1 to 7 of 7

copying folder contents

Hybrid View

Guest copying folder contents 06-20-2006, 04:35 PM
Guest Re: copying folder contents 06-20-2006, 05:15 PM
Guest RE: copying folder contents 06-21-2006, 07:15 AM
Guest Re: copying folder contents 06-21-2006, 07:30 AM
Guest Re: copying folder contents 06-21-2006, 07:45 AM
Guest Re: copying folder contents 06-21-2006, 05:00 PM
Guest RE: copying folder contents 06-22-2006, 07:15 AM
  1. #1
    jnewl
    Guest

    copying folder contents

    i based the following code on an example from copy files to other folder,
    recorded march 31, 2006

    Sub copyfolder_con()
    Dim strfom, strto As String
    Dim copyinfo As Object

    strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    nnyppo power play reports\ *.xls"
    MsgBox strfrom
    strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    MsgBox strto
    Set copyinfo = CreateObject("scripting.FileSystemObject")

    copyinfo.copyfile strfrom, strto, False

    End Sub


    strfrom and strto have valid values.

    it always abends at the copyinfo.copyfile statement.

    yet this is exactly what is in help and what was on for march 31.

    so why the abends?

    thanks


  2. #2
    Ron de Bruin
    Guest

    Re: copying folder contents

    Hi jnewl

    Try this to copy from C:\Data\*.* to C:\Paste

    Sub test()
    Dim objShell, objFolder
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace("C:\Paste")

    If (Not objFolder Is Nothing) Then
    objFolder.CopyHere ("C:\Data\*.*")
    End If

    End Sub


    --
    Regards Ron De Bruin
    http://www.rondebruin.nl



    "jnewl" <jnewl@discussions.microsoft.com> wrote in message news:C232F889-DAA2-4241-BAD6-83B3F1C9926F@microsoft.com...
    >i based the following code on an example from copy files to other folder,
    > recorded march 31, 2006
    >
    > Sub copyfolder_con()
    > Dim strfom, strto As String
    > Dim copyinfo As Object
    >
    > strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    > nnyppo power play reports\ *.xls"
    > MsgBox strfrom
    > strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    > MsgBox strto
    > Set copyinfo = CreateObject("scripting.FileSystemObject")
    >
    > copyinfo.copyfile strfrom, strto, False
    >
    > End Sub
    >
    >
    > strfrom and strto have valid values.
    >
    > it always abends at the copyinfo.copyfile statement.
    >
    > yet this is exactly what is in help and what was on for march 31.
    >
    > so why the abends?
    >
    > thanks
    >




  3. #3
    jnewl
    Guest

    RE: copying folder contents

    this did not help. got nothing after the execution of this code

    the previous code gave the msg ' could not find the path', but the contents
    for strfrom and strto were valid

    Sub copyfolder_con()
    'Dim strfom, strto As String
    'Dim copyinfo As Object

    'strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    nnyppo power play reports\ *.xls"

    'strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"

    'Set copyinfo = CreateObject("scripting.FileSystemObject")

    'copyinfo.copyfile strfrom, strto, False

    Dim objshell, objfolder
    Set objshell = CreateObject("shell.application")
    Set objfolder = objshell.Namespace("w:\adhoc \ ipa profiles \ 2006 \ test
    area")

    If (Not objfolder Is Nothing) Then
    objfolder.copyhere ("w:\adhoc \ ipa profiles \ 2006 \ power play reports
    for ipas \ nnyppo power play reports\ *.*")
    End If


    End Sub







    "jnewl" wrote:

    > i based the following code on an example from copy files to other folder,
    > recorded march 31, 2006
    >
    > Sub copyfolder_con()
    > Dim strfom, strto As String
    > Dim copyinfo As Object
    >
    > strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    > nnyppo power play reports\ *.xls"
    > MsgBox strfrom
    > strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    > MsgBox strto
    > Set copyinfo = CreateObject("scripting.FileSystemObject")
    >
    > copyinfo.copyfile strfrom, strto, False
    >
    > End Sub
    >
    >
    > strfrom and strto have valid values.
    >
    > it always abends at the copyinfo.copyfile statement.
    >
    > yet this is exactly what is in help and what was on for march 31.
    >
    > so why the abends?
    >
    > thanks
    >


  4. #4
    Andrew Taylor
    Guest

    Re: copying folder contents

    Are the spaces around some of the backslashes supposed to be there?


    jnewl wrote:
    > this did not help. got nothing after the execution of this code
    >
    > the previous code gave the msg ' could not find the path', but the contents
    > for strfrom and strto were valid
    >
    > Sub copyfolder_con()
    > 'Dim strfom, strto As String
    > 'Dim copyinfo As Object
    >
    > 'strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    > nnyppo power play reports\ *.xls"
    >
    > 'strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    >
    > 'Set copyinfo = CreateObject("scripting.FileSystemObject")
    >
    > 'copyinfo.copyfile strfrom, strto, False
    >
    > Dim objshell, objfolder
    > Set objshell = CreateObject("shell.application")
    > Set objfolder = objshell.Namespace("w:\adhoc \ ipa profiles \ 2006 \ test
    > area")
    >
    > If (Not objfolder Is Nothing) Then
    > objfolder.copyhere ("w:\adhoc \ ipa profiles \ 2006 \ power play reports
    > for ipas \ nnyppo power play reports\ *.*")
    > End If
    >
    >
    > End Sub
    >
    >
    >
    >
    >
    >
    >
    > "jnewl" wrote:
    >
    > > i based the following code on an example from copy files to other folder,
    > > recorded march 31, 2006
    > >
    > > Sub copyfolder_con()
    > > Dim strfom, strto As String
    > > Dim copyinfo As Object
    > >
    > > strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    > > nnyppo power play reports\ *.xls"
    > > MsgBox strfrom
    > > strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    > > MsgBox strto
    > > Set copyinfo = CreateObject("scripting.FileSystemObject")
    > >
    > > copyinfo.copyfile strfrom, strto, False
    > >
    > > End Sub
    > >
    > >
    > > strfrom and strto have valid values.
    > >
    > > it always abends at the copyinfo.copyfile statement.
    > >
    > > yet this is exactly what is in help and what was on for march 31.
    > >
    > > so why the abends?
    > >
    > > thanks
    > >



  5. #5
    jnewl
    Guest

    Re: copying folder contents

    if the spaces are there or not there, still get the same error msg. what is
    such a puzzle, is that this code is like the code outlined in the march 31
    response, yet does not work

    "Andrew Taylor" wrote:

    > Are the spaces around some of the backslashes supposed to be there?
    >
    >
    > jnewl wrote:
    > > this did not help. got nothing after the execution of this code
    > >
    > > the previous code gave the msg ' could not find the path', but the contents
    > > for strfrom and strto were valid
    > >
    > > Sub copyfolder_con()
    > > 'Dim strfom, strto As String
    > > 'Dim copyinfo As Object
    > >
    > > 'strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    > > nnyppo power play reports\ *.xls"
    > >
    > > 'strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    > >
    > > 'Set copyinfo = CreateObject("scripting.FileSystemObject")
    > >
    > > 'copyinfo.copyfile strfrom, strto, False
    > >
    > > Dim objshell, objfolder
    > > Set objshell = CreateObject("shell.application")
    > > Set objfolder = objshell.Namespace("w:\adhoc \ ipa profiles \ 2006 \ test
    > > area")
    > >
    > > If (Not objfolder Is Nothing) Then
    > > objfolder.copyhere ("w:\adhoc \ ipa profiles \ 2006 \ power play reports
    > > for ipas \ nnyppo power play reports\ *.*")
    > > End If
    > >
    > >
    > > End Sub
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > "jnewl" wrote:
    > >
    > > > i based the following code on an example from copy files to other folder,
    > > > recorded march 31, 2006
    > > >
    > > > Sub copyfolder_con()
    > > > Dim strfom, strto As String
    > > > Dim copyinfo As Object
    > > >
    > > > strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    > > > nnyppo power play reports\ *.xls"
    > > > MsgBox strfrom
    > > > strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    > > > MsgBox strto
    > > > Set copyinfo = CreateObject("scripting.FileSystemObject")
    > > >
    > > > copyinfo.copyfile strfrom, strto, False
    > > >
    > > > End Sub
    > > >
    > > >
    > > > strfrom and strto have valid values.
    > > >
    > > > it always abends at the copyinfo.copyfile statement.
    > > >
    > > > yet this is exactly what is in help and what was on for march 31.
    > > >
    > > > so why the abends?
    > > >
    > > > thanks
    > > >

    >
    >


  6. #6
    Ron de Bruin
    Guest

    Re: copying folder contents

    >got nothing after the execution of this code

    Then this path is not correct
    "w:\adhoc \ ipa profiles \ 2006 \ test area"
    go to the folder in Explorer and copy the path fron the address bar


    --
    Regards Ron De Bruin
    http://www.rondebruin.nl



    "jnewl" <jnewl@discussions.microsoft.com> wrote in message news:332ACA18-4FF2-475B-A60F-939AD296CA04@microsoft.com...
    > this did not help. got nothing after the execution of this code
    >
    > the previous code gave the msg ' could not find the path', but the contents
    > for strfrom and strto were valid
    >
    > Sub copyfolder_con()
    > 'Dim strfom, strto As String
    > 'Dim copyinfo As Object
    >
    > 'strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    > nnyppo power play reports\ *.xls"
    >
    > 'strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    >
    > 'Set copyinfo = CreateObject("scripting.FileSystemObject")
    >
    > 'copyinfo.copyfile strfrom, strto, False
    >
    > Dim objshell, objfolder
    > Set objshell = CreateObject("shell.application")
    > Set objfolder = objshell.Namespace("w:\adhoc \ ipa profiles \ 2006 \ test
    > area")
    >
    > If (Not objfolder Is Nothing) Then
    > objfolder.copyhere ("w:\adhoc \ ipa profiles \ 2006 \ power play reports
    > for ipas \ nnyppo power play reports\ *.*")
    > End If
    >
    >
    > End Sub
    >
    >
    >
    >
    >
    >
    >
    > "jnewl" wrote:
    >
    >> i based the following code on an example from copy files to other folder,
    >> recorded march 31, 2006
    >>
    >> Sub copyfolder_con()
    >> Dim strfom, strto As String
    >> Dim copyinfo As Object
    >>
    >> strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    >> nnyppo power play reports\ *.xls"
    >> MsgBox strfrom
    >> strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    >> MsgBox strto
    >> Set copyinfo = CreateObject("scripting.FileSystemObject")
    >>
    >> copyinfo.copyfile strfrom, strto, False
    >>
    >> End Sub
    >>
    >>
    >> strfrom and strto have valid values.
    >>
    >> it always abends at the copyinfo.copyfile statement.
    >>
    >> yet this is exactly what is in help and what was on for march 31.
    >>
    >> so why the abends?
    >>
    >> thanks
    >>




  7. #7
    jnewl
    Guest

    RE: copying folder contents

    hi,
    it was the from path that was wrong, there was a space after the last \
    so it could not find *.*

    thanks, for your help

    "jnewl" wrote:

    > i based the following code on an example from copy files to other folder,
    > recorded march 31, 2006
    >
    > Sub copyfolder_con()
    > Dim strfom, strto As String
    > Dim copyinfo As Object
    >
    > strfrom = "w:\adhoc \ ipa profiles \ 2006 \ power play reports for ipas \
    > nnyppo power play reports\ *.xls"
    > MsgBox strfrom
    > strto = "w:\adhoc \ ipa profiles \ 2006 \ test area"
    > MsgBox strto
    > Set copyinfo = CreateObject("scripting.FileSystemObject")
    >
    > copyinfo.copyfile strfrom, strto, False
    >
    > End Sub
    >
    >
    > strfrom and strto have valid values.
    >
    > it always abends at the copyinfo.copyfile statement.
    >
    > yet this is exactly what is in help and what was on for march 31.
    >
    > so why the abends?
    >
    > thanks
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1