unsure what to Set object to
Hello,
I'm having a problem with this code when viewed online. Here's the code:
VB Code:
Private Sub UserForm_Initialize()
Dim OldState As Integer
OldState = Application.WindowState
Application.WindowState = xlMaximized
Me.Top = Application.Top
Me.Left = Application.Left
Me.Height = Application.Height
Me.Width = Application.Width
Application.WindowState = OldState
End Sub
Evidently I must explicitly define "Application". So when I add:
Dim xlApp as Excel.Application
I'm unsure of what to set it to:
Set xlApp = ????????
I tried adding "Excel.Application" to each line:
OldState = Excel.Application.WindowState
Excel.Application.WindowState = xlMaximized
etc....
but I'm still getting error 1004, object not SET. What do I set the object to? This is straight Excel/VBA.
Thank you,
CJ