Results 1 to 4 of 4

Rename file when copied

Threaded View

  1. #1
    Registered User
    Join Date
    05-21-2013
    Location
    philippines
    MS-Off Ver
    Excel 2010
    Posts
    23

    Question Rename file when copied

    Hi Experts!
    Need your help I just copied and modify this code;
    What I want is to add sumting on the file name, without changing, file path, original file name and file extension

    Say;

    I get the file

    D: \Docs\Memo.docx

    I can paste it to the fnpath with a changed filename

    C: \_Temp\ Memo_BPMC-0001.docx

    Heres the code
    Any help will be highly appreciated
    Thanks in advance


    Private Sub CommandButton1_Click()
    Dim fn
    Dim FSO As Object
    Dim DOC_NUM As String
    Dim fnpath As String
    fnpath = Application.Path
    fnpath = tempPath & "C: \_Temp\"
    fn = Application.GetOpenFilename
    If fn = False Then
        MsgBox "Nothing Chosen"
    Else
         TextBox1.Value = fn     
        Set FSO = CreateObject("scripting.filesystemobject")
        FSO.CopyFile Source:=fn, Destination:=fnpath
        TextBox3.Value = fnpath
    End If    
    End Sub
    Last edited by arlu1201; 07-09-2013 at 02:07 AM.

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