i'm trying to write a code that saves a back up of an excel spreadsheet to the same shared folder, mapped to two different letters, only when certain users are saving. this is a file many people access, so I'd like to save a back up for only when myself or my coworker is in it.
I have the folder mapped to the G drive, my coworker has it on the I drive. How can I write the filepath to read both of our drives?
TIA!
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Environ("Username") <> "agene" And Environ("Username") <> "aking" Then
Exit Sub
End If
With ThisWorkbook
.SaveCopyAs ("\Excel\Backup\Backup of " & .Name)
End With
End Sub