Hello,
I have three workbooks, which have to execute the following code at a certain time.
WORKBOOK1 Code
WORKBOOK2 Code
WORKBOOK3 Code
My problem is that the workbook that is activated is the only one which get printed. The others give the folowwing error: "The macro may not be available in this workbook or all macros may be disabled."
But the macros are enabled in every workbook and they work if I just execute the macro when the workbook is activated. I have tried to add the Application.Run etc. but still can't fix the problem.
I have three workbooks, which have to execute the following code at a certain time.
WORKBOOK1 Code
VBA Code:
Private Sub Workbook_Open()
MsgBox "The sheets are printed."
Application.OnTime TimeValue("12:00:00"), "'Workbook1.xlsm'!PrintWB1"
Application.OnTime TimeValue("16:00:00"), "'Workbook1.xlsm'!PrintWB1"
End Sub
WORKBOOK2 Code
VBA Code:
Private Sub Workbook_Open()
MsgBox "The sheets are printed."
Application.OnTime TimeValue("12:00:00"), "'Workbook2.xlsm'!PrintWB2"
Application.OnTime TimeValue("16:00:00"), "'Workbook2.xlsm'!PrintWB2"
End Sub
WORKBOOK3 Code
VBA Code:
Private Sub Workbook_Open()
MsgBox "The sheets are printed."
Application.OnTime TimeValue("12:00:00"), "'Workbook3.xlsm'!PrintWB3"
Application.OnTime TimeValue("16:00:00"), "'Workbook3.xlsm'!PrintWB3"
End Sub
My problem is that the workbook that is activated is the only one which get printed. The others give the folowwing error: "The macro may not be available in this workbook or all macros may be disabled."
But the macros are enabled in every workbook and they work if I just execute the macro when the workbook is activated. I have tried to add the Application.Run etc. but still can't fix the problem.