Hi all,
Hope you can Help i'm fairly new to VBA and Userforms.
We have a userform which we want filling in but don't want to show the excel in the background as we want to try limit anyone from going in and updating it, this works fine if there are no other workbooks open but if there is the code i have currently is causing a runtime 438 error
It's being opened from sharepoint and we have had a few instances were data isn't being saved as it's opened in read only hence the code to open in edit mode.
here is the code I have (i've highlighted the line debug is showing me as being at fault in red)
/**************************************************/
Private Sub Workbook_Open()
Application.DisplayAlerts = False
If ActiveWorkbook.ReadOnly = True Then
ActiveWorkbook.LockServerFile
End If
If Workbooks.Count > 1 Then 'if more than 1 excel instance open
Workbooks("ExcelUserformName.xlsm.").Visible = False ' hide the workbook
Else
Application.Visible = False ' hide the excel for userform
End If
Userform1.Show 'show the Userform
End Sub
Any Advice would be appreciated. This is hopefully the last hurdle to haveing a nicely functioning userform
Hope you can Help i'm fairly new to VBA and Userforms.
We have a userform which we want filling in but don't want to show the excel in the background as we want to try limit anyone from going in and updating it, this works fine if there are no other workbooks open but if there is the code i have currently is causing a runtime 438 error
It's being opened from sharepoint and we have had a few instances were data isn't being saved as it's opened in read only hence the code to open in edit mode.
here is the code I have (i've highlighted the line debug is showing me as being at fault in red)
/**************************************************/
Private Sub Workbook_Open()
Application.DisplayAlerts = False
If ActiveWorkbook.ReadOnly = True Then
ActiveWorkbook.LockServerFile
End If
If Workbooks.Count > 1 Then 'if more than 1 excel instance open
Workbooks("ExcelUserformName.xlsm.").Visible = False ' hide the workbook
Else
Application.Visible = False ' hide the excel for userform
End If
Userform1.Show 'show the Userform
End Sub
Any Advice would be appreciated. This is hopefully the last hurdle to haveing a nicely functioning userform