Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2007
    Posts
    48

    Unanswered: Use standard Windowes popup screen

    I am using VBA FileCopy to copy a file from server to local HDD, and it is a very slow process.

    Can anyone please advise how I can find and apply the standard Windows copying popup window with the animated flying folder?

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I've always used this little vb script to copy a file (paste the code below into notepad and save as a .vbs file type.) It executes very fast (does a 30 meg file in 1 second.) I'm guessing if it were a larger file and took longer, you'd see the flying folder.

    I use it to clone the source mde, adding the users login name to the cloned file, and then launch the cloned file. It can be used to do a copy of any file (I've used it for Word and Excel files) and doesn't necessarily need to launch the mdb/mde. My users always open my mde's using this script. Once you've created the *.vbs file, you then only need to double-click on it to run it.

    It's not as overwhelming as it seems (mostly comments). There are really only a couple of lines you need to modify.

    'This script was created by Dan Wang and Paul Kohn.
    'All code in this script was gotten from website examples.
    'The purpose of this script is to clone an mde/mdb file, add the users loginID to the cloned file,
    'And execute the cloned file with the users loginID. Thus protecting the working mde/mdb file so it is
    'Never opened exclusively and new code can be copied without having all users close the working mde/mdb file.
    'No 3rd party software is needed to run this script except wscript.exe which comes with windows.
    'Edit this script with notepad and then save the changes (keep the .vbs extension.) - Make sure to save it as a *.vbs file
    ' type or the script won't run! (you may have to change file types from *.txt to *.* but save it with a *.vbs (ex: SomeName.vbs)
    'It can be used to clone any file type (Excel, Word, etc...)
    'And can be used to clone that Excel, Word, etc file with the users login name and launch the cloned file.
    'Feedback can be sent to pkohn@charter.net or danw@weccusa.org
    'Feel free to distribute this script to others.

    Set WshNetwork = CreateObject("WScript.Network")
    GetUser = WshNetwork.UserName
    Set WshNetwork = Nothing

    'Change the LUNmae location below. It's best to use the UNC path and filename.
    'It's also best to clone an mde verses an mdb file but this script will work with either.
    'Do NoT use this script unless you've either split the MSAccess data files and are using MSAccess linked tables
    'Or SQL Server linked tables (you don't want to clone the data tables).
    'But can be used to clone excel or word or other files.
    LUName = "c:\HelpForOthers\PKSampleXP.mde"
    ' Ex: LUName = "\\Databases\Silverstone.mde"
    ' Ex: LUName = "C:\DatabasesEDP\NewSilverStone\SilverStone2002.md e"
    ' Ex: LUName = "C:\DatabasesEDP\NewSilverStone\MyExcelFile.xl s"

    oldname = LUName

    'Change the mde in the line below to mdb for mdb files (xls for excel, etc..). GetUser gets the user's loginID for Windows.
    newName = Replace(LUName, ".mde", "") & GetUser & ".mde"
    'ex: newName = Replace(LUName, ".mdb", "") & GetUser & ".mdb"
    'ex: newName = Replace(LUName, ".xls", "") & GetUser & ".xls"

    retval = 0
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    'Copy file - this code below can be used to copy other files as well!!
    retval = objFSO.CopyFile(oldname, newName, True)

    Set objFSO = Nothing

    Dim objShell
    Set objShell = CreateObject("Wscript.Shell")

    'Now open the new MSAccess cloned file with the user name. Change MSAccess.exe to execute other file types.
    objShell.Run "MSAccess.exe " & newName
    'ex: objShell.Run "Excel " & newName

    Set objShell = Nothing
    Last edited by pkstormy; 01-17-08 at 22:56.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Very nice

    Just a few comment lines
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Dec 2007
    Posts
    48
    Many thanks Paul, will give this a go.
    The more comment lines, the easier it is to understand, and the less chance of a mistake. Much appreciated.

    I like your standard of documentation, so keep up the good work

    kind regards,
    Jill

  5. #5
    Join Date
    Dec 2007
    Posts
    48
    yeah, I know StarTrekker was being cheeky!!

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Me? Never!
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    It'd be a dull website if everyone was always serious and didn't kid around. You should see some of the little things I throw in some of my programs.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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