Results 1 to 6 of 6

Thread: Files

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Perth, WA
    Posts
    35

    Post

    I am in dire need of knowing the syntax for copying files thru VB

    i am trying to incorporate a backup function for the database and need to know how to copy it to another file

    i also need to know if it is possibe to automate a mail merge thru VB but thats not really a major issue in the program

    thanks in advance for any help available

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    look at the filecopy funtion in help

    ------------------
    DiGiTaIErRoR
    VB, QBasic, Iptscrae, HTML
    Quote: There are no stupid questions, just stupid people.

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Perth, WA
    Posts
    35

    Post

    You mean, as in the MSDN stuff??

    i dont Have the MSDN libraries, company copy, small machine, no room, no cd

    does anyone have an example of filecopy code?

  4. #4
    Member
    Join Date
    Sep 1999
    Location
    Lebanon, Beirut
    Posts
    63

    Post

    I think u will b ... good luck

    Sub CopyFile(SourceFile As String, DestFile As String)
    FileCopy SourceFile, DestFile
    End Function



    ------------------
    BlackRose


  5. #5
    Member
    Join Date
    Sep 1999
    Location
    Lebanon, Beirut
    Posts
    63

    Post

    if u need something more Pro. try this API
    yeh ... I like this one

    Create a module and type the following lines in the Declarations section:


    Option Explicit

    Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
    (ByVal lpExistingFileName As String, _
    ByVal lpNewFileName As String, _
    ByVal bFailIfExists As Long) As Long
    Type the following procedure:


    Sub CopyFile(SourceFile As String, DestFile As String)
    '---------------------------------------------------------------
    ' PURPOSE: Copy a file on disk from one location to another.
    ' ACCEPTS: The name of the source file and destination file.
    ' RETURNS: Nothing
    '---------------------------------------------------------------
    Dim Result As Long
    If Dir(SourceFile) = "" Then
    MsgBox Chr(34) & SourceFile & Chr(34) & _
    " is not valid file name."
    Else
    Result = apiCopyFile(SourceFile, DestFile, False)
    End If
    End Sub

    To test this procedure, type the following line in the Immediate window, and then press ENTER:

    CopyFile "<pathNorthwind.mdb>", "C:\Northwind.mdb"


    ------------------
    BlackRose


  6. #6

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Perth, WA
    Posts
    35

    Post

    cheers for the replies

Posting Permissions

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



Click Here to Expand Forum to Full Width