mattwork
02-21-2014, 04:53 AM
Hi All, Can anyone help me fix this macro? I've included the code below:
Sub auto_open()
' formatscreen
' 'frmsplashscreen.Show
' If ActiveWorkbook.readonly = True Then GoTo readonly
' Clear any existing data
' Worksheets("Data").Visible = True
' Worksheets("Data").Select
' UnProtect
' Range("a1:b999").Clear
' Range("e1:f999").Clear
' Worksheets("Background").Select
' GoTo exithere
'readonly:
' MsgBox ("Data entry file is in use by someone else - please try again later.")
' Application.ScreenUpdating = True
' With ActiveWindow
' .DisplayFormulas = True
' .DisplayGridlines = True
' .DisplayHeadings = True
' .DisplayHorizontalScrollBar = True
' .DisplayVerticalScrollBar = True
' .DisplayWorkbookTabs = True
'End With
With Application
.DisplayFormulaBar = True
.DisplayStatusBar = True
End With
Application.DisplayFullScreen = False
frmmainmenu.Hide
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
'
exithere:
' MsgBox ("Please note - use the 'Exit' option to leave this system. This ensures that the display is updated correctly.")
Call btnloaddata
Call btnprocessdata
dataprocessed = False
End Sub
The Part where it is going wrong is the "frmmainmenu.Hide" and its coming up with run time error 424. My knowledge of VBA is very limited so please give as much detail as you can in any answers.
Thanks in advance
Sub auto_open()
' formatscreen
' 'frmsplashscreen.Show
' If ActiveWorkbook.readonly = True Then GoTo readonly
' Clear any existing data
' Worksheets("Data").Visible = True
' Worksheets("Data").Select
' UnProtect
' Range("a1:b999").Clear
' Range("e1:f999").Clear
' Worksheets("Background").Select
' GoTo exithere
'readonly:
' MsgBox ("Data entry file is in use by someone else - please try again later.")
' Application.ScreenUpdating = True
' With ActiveWindow
' .DisplayFormulas = True
' .DisplayGridlines = True
' .DisplayHeadings = True
' .DisplayHorizontalScrollBar = True
' .DisplayVerticalScrollBar = True
' .DisplayWorkbookTabs = True
'End With
With Application
.DisplayFormulaBar = True
.DisplayStatusBar = True
End With
Application.DisplayFullScreen = False
frmmainmenu.Hide
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
'
exithere:
' MsgBox ("Please note - use the 'Exit' option to leave this system. This ensures that the display is updated correctly.")
Call btnloaddata
Call btnprocessdata
dataprocessed = False
End Sub
The Part where it is going wrong is the "frmmainmenu.Hide" and its coming up with run time error 424. My knowledge of VBA is very limited so please give as much detail as you can in any answers.
Thanks in advance