PDA

View Full Version : Compile error when clicking inside a userform



Dfense
01-23-2008, 04:49 PM
I found some code on how to re-positon a uerform upon startup and pasted it into my module. It works okay except when I click on a "non active" area of the userform...I get a compile error that looks like this. Can someone explain my problem with the code I am using?

Private Sub UserForm_Click()
Option Explicit

With UserForm1
Top = Application.Top + 182 '< change 125 to what u want
Left = Application.Left + 667 '< change 25 to what u want
End With
End Sub

Thanks,

Bob Phillips
01-23-2008, 05:18 PM
Option Explict should not be inside a procedure, it sould be at the head of the module.

And you should probably use UserfOrm_Activate not Userform_Click.