View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Souny Souny is offline
external usenet poster
 
Posts: 40
Default Question on Form Textboxes

Hi michdenis,

Thanks for your response. I am not familiar with "Microsoft Excel Dialog
sheet 5". Is it one of the references in VBA? How can I activate that?

Thanks.

"michdenis" wrote:

Hi,

You are doing reference to "Microsoft Excel Dialog sheet 5"
On those sheets, it is possible to add Textboxes using
form tools bar.

Unfortunately, i do not know how to deal programmatically
with these objects. I may just give you some tips.

if you want to see their tab in your workbook
'----------------------------------
Dim Dial As DialogSheet
For Each Dial In DialogSheets
Dial.Visible = True
Next
'----------------------------------

Example : Suppose a dialog sheet having "Dialogue1" as caption

Here some lines of code that may help you !
'------------------------------------------------
Sub test()

Dim X As DialogSheet
Dim Sh As Shape

Set X = DialogSheets("Dialogue1")

X.Unprotect True
'to give a title to the dialog sheet
X.DialogFrame.Caption = "What a day!"

'Loop through all objects on this dialogsheet
For Each Sh In X.Shapes
'to affect only textbox (EditBox)
If TypeName(Sh.OLEFormat.Object) = "EditBox" Then
'if necessary
Sh.OLEFormat.Object.MultiLine = True
'affect creation mode only
'you can still modify text when showed
Sh.OLEFormat.Object.Locked = False
Sh.OLEFormat.Object.LockedText = False
'Add some text...
Sh.OLEFormat.Object.Text = "it works"
'affect dialogsheet when showed
Sh.ControlFormat.Enabled = True
End If
Next
X.Protect , DrawingObjects:=True, contents:=True
X.Show
'------------------------------------------------