With caption name

VB Code:
  1. ' Code on Form1
  2.     Dim strCaption As String
  3.     Dim MyObject   As Form
  4.    
  5.     Form2.Show
  6.     strCaption = "Form2"
  7.        
  8.     For Each MyObject In Forms
  9.         If MyObject.Name = strCaption Then
  10.            MyObject.Width = MyObject.Width - 500
  11.            MyObject.Height = MyObject.Height - 500
  12.            Exit For
  13.         End If
  14.     Next