S
Sadat
Hello.
In my previous post Douglas helped me a lot about how to put a browse button
on the form and then copying the selected file directly to a folder. Thanks
Douglas for your valuable suggestions. Now I am thinking something different.
Would it be possible to save the files in different folders given that the
name of the folder is taken from a combo or text box. How can it be done? I
am also giving code with which I copy files to a folder.
The Code:
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click
Dim strFIleName As String
Dim strInputFilePath As String
Dim strNewFilePath As String
strInputFilePath = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
strFIleName = Dir(strInputFilePath)
strNewFilePath = "C:\Documents and Settings\smainuddin\My
Documents\Distribution Life Cycle\Compliance and Communication Documentation
Project\Master Folder" & strFIleName
Me.DocumentPath = "#" & strNewFilePath & "#"
If Len(Dir(strNewFilePath)) > 0 Then
' file already exists
If MsgBox(strNewFilePath & " already exists." & vbCrLf & _
"Do you wish to delete it?", vbYesNo + vbQuestion) = vbYes Then
Kill strNewFilePath
End If
End If
FileCopy strInputFilePath, strNewFilePath
Exit_Command30_Click:
Exit Sub
Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click
End Sub
Thanks and regards,
Sadat Mainuddin
In my previous post Douglas helped me a lot about how to put a browse button
on the form and then copying the selected file directly to a folder. Thanks
Douglas for your valuable suggestions. Now I am thinking something different.
Would it be possible to save the files in different folders given that the
name of the folder is taken from a combo or text box. How can it be done? I
am also giving code with which I copy files to a folder.
The Code:
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click
Dim strFIleName As String
Dim strInputFilePath As String
Dim strNewFilePath As String
strInputFilePath = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
strFIleName = Dir(strInputFilePath)
strNewFilePath = "C:\Documents and Settings\smainuddin\My
Documents\Distribution Life Cycle\Compliance and Communication Documentation
Project\Master Folder" & strFIleName
Me.DocumentPath = "#" & strNewFilePath & "#"
If Len(Dir(strNewFilePath)) > 0 Then
' file already exists
If MsgBox(strNewFilePath & " already exists." & vbCrLf & _
"Do you wish to delete it?", vbYesNo + vbQuestion) = vbYes Then
Kill strNewFilePath
End If
End If
FileCopy strInputFilePath, strNewFilePath
Exit_Command30_Click:
Exit Sub
Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click
End Sub
Thanks and regards,
Sadat Mainuddin