I have made a .xlam file that holds some macro's. I use these macro's as a button in my ribbon. Most of these macro's are opening other Excel sheets. But whenever I use that macro's the ribbon is blocking, I can not use any of the tabs or the buttons in those tabs.
Does anyone know why this happens? This is an example of the code that I added as a macro in the ribbon.
Sub OpenBureauplanning()
Application.ScreenUpdating = False
Dim Path As String
Path = "J:\Planning\Bureauplanning\"
Dim openfile As String
openfile = Path & "Bureauplanning.xlsm"
Workbooks.Open (openfile)
Application.ScreenUpdating = True
End Sub
After the replies from Dai. I removed the part "application.screenupdating" then its working fine.
In a different code, I use a form to determine which file needs to be opened. I also use that code in my ribbon.
That code is this:
Sub OpenProjectplanning()
Open_projectplanning.Show
End Sub
When running this code these forms get opened. In this form, people fill in the project number from the file that needs to be opened.
When the button "openen" is pressed the following code is starting:
Private Sub CommandButton1_Click()
Dim Path As String
Path = "J:\Planning\Projecten\"
Dim File As String
File = TextBox1.Text
Dim openfile As String
openfile = Path & File & ".xlsm"
Workbooks.Open (openfile)
Unload Me
End Sub
When opening the project file this code is automatically running on open:
Private Sub Workbook_Open()
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
Application.DisplayStatusBar = True
ThisWorkbook.Worksheets("Planning").Activate
End Sub
After running these codes, the ribbon is blocked.