You're passing the control itself to the Sub (see next sentence), so use the passed control variable rather than whatever you are trying to do accessing it via the parent variable's With statement. Also, why is it a Function if there is nothing being returned?
Code:With objPARENT If TypeOf objPARENT Is Form Then objCTL.Left = (.ScaleWidth / 2) - (objCTL.Width / 2) objCTL.Top = (.ScaleHeight / 2) - (objCTL.Height / 2) Else objCTL.Left = (.Width / 2) - (objCTL.Width / 2) objCTL.Top = (.Height / 2) - (objCTL.Height / 2) End If End With




Reply With Quote
