I have some code which I want to share with other users and so when they run the workbook from their Downloads folder, I want each user to be able to run it. Basically username1 will change for each user.
I tried the examples -> HERE
Here is the code I have:
Sub CopyTime()
Dim rFind As Range
Dim rDelete As Range
Dim strSearch As String
Dim iLookAt As Long
Dim bMatchCase As Boolean
Dim WS7 As Worksheet
Const csvFile = "C:\Users\username1\Downloads\Login_Logout_Report.csv"
Dim ws As Worksheet, csv As Workbook, cCount As Long, cName As String
Dim wb1 As Excel.Workbook
Set wb1 = Workbooks.Open("C:\Users\username1\Downloads\ShiftTime.xlsm")
' Other code goes here
End Sub
Here is what I have tried
Const csvFile = "C:\Users\" & Environ("UserName") & "\Downloads\Login_Logout_Report.csv"
Dim ws As Worksheet, csv As Workbook, cCount As Long, cName As String
Dim wb1 As Excel.Workbook
Set wb1 = Workbooks.Open("C:\Users\" & Environ("UserName") & "\Downloads\ShiftTime.xlsm")