Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel 2007 create a copy of a file using vb on form

    I’ve created a VB form for use on an Excel 2007 spreadsheet running in compatibility mode.

    Amongst other things, I’m data capturing a Surname and a file name, and writing this to my spreadsheet with loads of other data. This is working fine.

    I would now like to add a routine to my save button which writes the data to the spreadsheet. I need it to create a copy of the file whose name I captured and Append the Surname in front of the existing file name, so I would data capture

    Label Name Data

    txtsnam Surname Smith

    txtfilenam FileName DSC02345.jpg

    I then want a copy of this file created as

    Copy file to be named Smith_DSC02345.jpg

    Working out how to do this is beyond my knowledge & understanding, I can usually work these things out with a few solid hints, but getting the initial start is often beyond me.

    Can anyone help please.

    Thanks

    Colin

  2. #2
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, partly there

    Dim savnam As String
    Dim newsavnam As String


    savnam = ("txtimgno")
    newsavnam = ("txtsname" & "_" & "txtfnam" & "_" & "txtimgno")

    FileCopy "H:\Doc\Test\V1\[savnam].jpg", "H:\Doc\Test\V1\[newsavnam].jpg"



    Thats not working yet, but its near!
    Colin

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Solved prob. Thanks

Posting Permissions

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