Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Rose Howard   on Nov 26 In MS Office Category.

  
Question Answered By: Rachael Ferguson   on Nov 26


I had a quick glance at your code.
First, I would advise you to call your sub from the initialize event of the
forn and not the activate event.
Second, and only to help you in the future, I would advise you to name your
string
strFormName as string  and not varFormName as String
This should make reading and understanding your code  easier later on.

And now to the point:

What is the name of your form? what is "frmStart "?
is frmStart the name of your form. If so, you should access  its caption  by the
following:
frmStart.caption and not userform(frmStart).caption

I have written a small code to try to make this point clear. I hope this will
help you:
Try the following code. Please note the name of myform is "UserForm1" - this
is the default name of the first form. Change this as per your need.

Private Sub UserForm_Initialize()
Call SetFormCaption
End Sub

Sub SetFormCaption()
Dim strFormName As String

strFormName = UserForm1.Caption
strFormName = lblCaptionTitle & ": " & strFormName
UserForm1.Caption = strFormName

End Sub

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Changing Caption of form by name at runtime Or get search suggestion and latest updates.


Tagged: