Newb here. So I've made an excel workbook for log sheets for the company I'm interning at. Simply put, the plant operators use the sheet to log equipment conditions every 2 hours using a save macro button. It's been working great, but the problem I have is that the change directory macro isn't working (or isn't working the way I'd expect it to). There are two operators that use the same computer, so every now and then the macro saves the file in the wrong place.
Here is the save portion of the macro:
Here is the save portion of the macro:
Option Explicit
Sub SvAs()
'Saves filename as value of W22 plus the current date \\Prnts2\dryerlog\West Curd Log\electronic log sheet\
MsgBox "Saving Log Book to the Server"
Dim newFile As String, fName As String
fName = Range("W22").Value
newFile = fName & " " & Format$(Date, "mm-dd-yyyy")
'Directory Change
ChDir "\\Prnts2\dryerlog\West Curd Log\electronic log sheet"
'
ActiveWorkbook.SaveAs Filename:=newFile
Does anyone have any ideas on why it isn't changing the directory? Sometimes it works if I run the macro a few times in a row. Thanks in advance!Sub SvAs()
'Saves filename as value of W22 plus the current date \\Prnts2\dryerlog\West Curd Log\electronic log sheet\
MsgBox "Saving Log Book to the Server"
Dim newFile As String, fName As String
fName = Range("W22").Value
newFile = fName & " " & Format$(Date, "mm-dd-yyyy")
'Directory Change
ChDir "\\Prnts2\dryerlog\West Curd Log\electronic log sheet"
'
ActiveWorkbook.SaveAs Filename:=newFile