gogetsome
asked on
Change filename before saving image
Hello, given the code below how can I change the filename of the image? Perhaps just adding the date to the original filename to help prevent overwriting any images.
Private Sub btn_Add_Picture1_Click()
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "JPEG Files (*.jpg)", "*.jpg")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, _
OpenFile:=False, _
DialogTitle:="Save Image As...", _
Flags:=ahtOFN_HIDEREADONLY)
Dim strPath As String
strPath = strInputFileName
Dim strFile As String
strFile = Right(strPath, Len(strPath) - InStrRev(strPath, "\"))
If Len(strInputFileName) > 0 Then
Dim fs As Object
Dim oldPath As String, newPath As String
oldPath = strInputFileName
newPath = GetDefaultFilePath
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile oldPath, newPath & "\" & strFile
Set fs = Nothing
Me.txt_Picture1.Visible = True
Me.txt_Picture1.SetFocus
Me.txt_Picture1.Text = strFile
Me!Picture1.Picture = newPath & "\" & strFile
Screen.PreviousControl.SetFocus
Me.txt_Picture1.Visible = False
Else
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.