J
Jaymac
Hi folks
I am trying to write a macro which will save files to both my C:\ Drive and
an external usb drive with the identification I:\ for backup purposes.
Folder and sub-folder names on both drives are identical, as are the file
names. I have used the following code:
Set fd = Application.FileDialog(msoFileDialogSaveAs)
Dim vrtSelectedItem, vrtsave As Variant
With fd
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
vrtsave = "I" & Mid(vrtSelectedItem, 2, Len(vrtSelectedItem) - 1)
Next vrtSelectedItem
Else
End If
If .Show = -1 Then
Select Case .DialogType
Case msoFileDialogSaveAs: .Execute
Case Else
End Select
Else
End If
vrtSelectedItem = vrtsave
MsgBox "The path is: " & vrtSelectedItem
Select Case .DialogType
Case msoFileDialogSaveAs: .Execute
Case Else
End Select
End With
End Sub
which was taken from the help files and 'modified'. I presumed the second
'.execute' statement would operate on the vrtSelectedItem modified to have an
"I" instead of a "C", but this doesn't work.
I would appreciate any help I can get.
Many thanks
I am trying to write a macro which will save files to both my C:\ Drive and
an external usb drive with the identification I:\ for backup purposes.
Folder and sub-folder names on both drives are identical, as are the file
names. I have used the following code:
Set fd = Application.FileDialog(msoFileDialogSaveAs)
Dim vrtSelectedItem, vrtsave As Variant
With fd
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
vrtsave = "I" & Mid(vrtSelectedItem, 2, Len(vrtSelectedItem) - 1)
Next vrtSelectedItem
Else
End If
If .Show = -1 Then
Select Case .DialogType
Case msoFileDialogSaveAs: .Execute
Case Else
End Select
Else
End If
vrtSelectedItem = vrtsave
MsgBox "The path is: " & vrtSelectedItem
Select Case .DialogType
Case msoFileDialogSaveAs: .Execute
Case Else
End Select
End With
End Sub
which was taken from the help files and 'modified'. I presumed the second
'.execute' statement would operate on the vrtSelectedItem modified to have an
"I" instead of a "C", but this doesn't work.
I would appreciate any help I can get.
Many thanks