ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Tuesday and filedate (https://www.excelbanter.com/excel-programming/394451-tuesday-filedate.html)

Ronel

Tuesday and filedate
 
I have a file and want it saved onto a server if it is opened on a Tuesday.
I have written code and it works perfectly on my machine, but when I put the
file onto 150 users' machines, the code does not run at all.
Public ronel, mydate As Date
Public inside, x As String


Private Sub workbook_open()
mydate = Worksheets("RBEU Input").Range("il2").Value
inside = Weekday(mydate)
ronel = FileDateTime("C:\Documents and Settings\abrl128\Desktop\Workflow
Input.xls")
x = Weekday(ronel)

If (inside = 3 And (x < 3 Or x 3)) Then
Application.DisplayAlerts = False
ChDir "\\10.6.40.77\Shared Files\Workflow\Input\"
ActiveWorkbook.SaveAs Filename:="\\10.6.40.77\Shared
Files\Workflow\Input\Input_abrl128.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, _
CreateBackup:=False

ChDir "C:\Documents and Settings\abrl128\Desktop\"
ActiveWorkbook.SaveAs Filename:="C:\Documents and
Settings\abrl128\Desktop\Workflow Input.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, _
CreateBackup:=False
Application.DisplayAlerts = True
End If
End Sub



When I open the file on my machine, it saves to the server. When the user
opens the file on his machine, nothing happens and the file lets him work on
it and save and go crazy, like it should, but I dont see a copy of his file
on my server. I am frustrated and dont know why it does this. The user has
his own copy of the file on his own machine....WHAT AM I GOING TO DO?

John Bundy

Tuesday and filedate
 
Not totally sure but this looks fishy to me
C:\Documents and Settings\abrl128\Desktop\Workflow
Input.xls")

looks like you are setting the file at a static location, this will only
work if the file is in the same place on everyones drive. Check on
activeworkbook.path. I may be off target without being able to run it but
that piece is the only one i see that could cause errors on all machines but
the one it was built on.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Ronel" wrote:

I have a file and want it saved onto a server if it is opened on a Tuesday.
I have written code and it works perfectly on my machine, but when I put the
file onto 150 users' machines, the code does not run at all.
Public ronel, mydate As Date
Public inside, x As String


Private Sub workbook_open()
mydate = Worksheets("RBEU Input").Range("il2").Value
inside = Weekday(mydate)
ronel = FileDateTime("C:\Documents and Settings\abrl128\Desktop\Workflow
Input.xls")
x = Weekday(ronel)

If (inside = 3 And (x < 3 Or x 3)) Then
Application.DisplayAlerts = False
ChDir "\\10.6.40.77\Shared Files\Workflow\Input\"
ActiveWorkbook.SaveAs Filename:="\\10.6.40.77\Shared
Files\Workflow\Input\Input_abrl128.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, _
CreateBackup:=False

ChDir "C:\Documents and Settings\abrl128\Desktop\"
ActiveWorkbook.SaveAs Filename:="C:\Documents and
Settings\abrl128\Desktop\Workflow Input.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, _
CreateBackup:=False
Application.DisplayAlerts = True
End If
End Sub



When I open the file on my machine, it saves to the server. When the user
opens the file on his machine, nothing happens and the file lets him work on
it and save and go crazy, like it should, but I dont see a copy of his file
on my server. I am frustrated and dont know why it does this. The user has
his own copy of the file on his own machine....WHAT AM I GOING TO DO?



All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com