maclachlan19
Board Regular
- Joined
- Jul 8, 2013
- Messages
- 53
Hoping somebody can help, I'm a rookie in VBA (but learning).
I have the piece of code below and had 2 questions.
1. I would like to add code so that if the Path isn't available the spreadsheet doesn't give the user an error upon opening. This could happen if the user moves the file from the shared folder.
2. What does the Option Explicit do at the start of the code, is this required or should it be there.
Thanks
Option Explicit
Private Sub Workbook_Open()
Open ThisWorkbook.Path & "\old reports\logfiles\ELR Analysis.log" For Append As #1
Print #1 , Application.UserName, Now
Close #1
End Sub
I have the piece of code below and had 2 questions.
1. I would like to add code so that if the Path isn't available the spreadsheet doesn't give the user an error upon opening. This could happen if the user moves the file from the shared folder.
2. What does the Option Explicit do at the start of the code, is this required or should it be there.
Thanks
Option Explicit
Private Sub Workbook_Open()
Open ThisWorkbook.Path & "\old reports\logfiles\ELR Analysis.log" For Append As #1
Print #1 , Application.UserName, Now
Close #1
End Sub