PDA

View Full Version : Run time error 424



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

westconn1
02-21-2014, 05:34 AM
possibly frmmainmenu is not loaded, or does not exist

p45cal
02-21-2014, 09:34 AM
possibly frmmainmenu is not loaded, or does not existExactly, it probably doesn't exist, no error is brought up with the .Hide command even where a userform exists but hasn't been .Shown or Loaded (xl 2010).