Hi I am trying to run this code to get current path and save to Location worksheet in B1 cell.
It worked perfectly fine couple of time but now it shows currenct path is "C:\Users\pushp\OneDrive\Documents"
Please help.
It worked perfectly fine couple of time but now it shows currenct path is "C:\Users\pushp\OneDrive\Documents"
Please help.
VBA Code:
Sub Get_current_Path()
'Variable declaration
Dim sDir As String
'Get current directory
sDir = CurDir
'Display output on the screen
MsgBox "Current Directory is " & sDir
Worksheets("Location").Activate
Range("B1").Value = sDir
End Sub
Last edited by a moderator: