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

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Excel 2007 create a copy of a file using vb on form

    • This topic has 2 replies, 1 voice, and was last updated 14 years ago.
    Author
    Topic
    #475684

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1273495

      Hi, partly there

      Dim savnam As String
      Dim newsavnam As String

      savnam = (“txtimgno”)
      newsavnam = (“txtsname” & “_” & “txtfnam” & “_” & “txtimgno”)

      FileCopy “H:DocTestV1[savnam].jpg”, “H:DocTestV1[newsavnam].jpg”

      Thats not working yet, but its near!
      Colin

    Viewing 0 reply threads
    Reply To: Excel 2007 create a copy of a file using vb on form

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: