Paste .xlsm file by browser option enabled (1 Viewer)

Rakesh935

Registered User.
Local time
Today, 11:39
Joined
Oct 14, 2012
Messages
71
Copy Paste .xlsm file by browser option enabled

Hi,

I have a code (below mentioned) which (in access file) will copy and paste a .xlsm file from one location to another location.

All I want is to get a browser option while pasting the .xlsm file. Request to see the below code and help in modifying it according to the requirement (for the "topath" )

Private Sub Command6_Click()
'This example copy all files and subfolders from FromPath to ToPath.
'Note: If ToPath already exist it will overwrite existing files in this folder
'if ToPath not exist it will be made for you.
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
FromPath = "C:\Documents and Settings\8707516\My Documents\Automations\232\New Folder" '<< Change
ToPath = "C:\Documents and Settings\8707516\Desktop\232" '<< Change
'If you want to create a backup of your folder every time you run this macro
'you can create a unique folder with a Date/Time stamp.
'ToPath = "C:\Users\Ron\" & Format(Now, "yyyy-mm-dd h-mm-ss")
If Right(FromPath, 1) = "\" Then
FromPath = Left(FromPath, Len(FromPath) - 1)
End If
If Right(ToPath, 1) = "\" Then
ToPath = Left(ToPath, Len(ToPath) - 1)
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
FSO.CopyFolder Source:=FromPath, Destination:=ToPath
MsgBox "You can find the files and subfolders from " & FromPath & " in " & ToPath
End Sub
 
Last edited:

Users who are viewing this thread

Top Bottom