Hello, I have the following problem with word 2000 and vba programming
I have placed a textbox control within a word document via VBA and the
accessible default objects. The control has been named to
TextboxNotice. This control should be shown or hidden via Button Clicks
from other controls or due to other program conditions.
I thought that I can do this with the .visible property - but this
property isn't shown in the poperty sheet of this control and
programcode like below always gives a runtime error 438. I have the
same problem with CommandButton objects. Whats going wrong?
Thanks in advance for helpfull informations
part of VBA program code from the word document:
Private Sub CommandButtonOn_Click()
TextboxNotice.Visible = True <----- run time error
End Sub
Private Sub CommandButtonOff_Click()
TextboxNotice.Visible = False <----- run time error
End Sub
Cindy M. - 24 Nov 2006 15:02 GMT
Hi Dod,
> I have placed a textbox control within a word document via VBA and the
> accessible default objects. The control has been named to
[quoted text clipped - 4 lines]
> programcode like below always gives a runtime error 438. I have the
> same problem with CommandButton objects. Whats going wrong?
ActiveX controls have different properties, depending on the container
they're in. So some things available in a userForm won't be when a
control is in a document.
There is really no good way to display/hide ActiveX controls in a Word
document while viewing the document. Closest you can get is to cover them
with a white rectangle (no borders)...
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
Helmut Weber - 27 Nov 2006 08:57 GMT
Hi,
have a look at this one:
Sub Test400s()
Dim oInl As InlineShape
For Each oInl In ActiveDocument.InlineShapes
If oInl.OLEFormat.ClassType = "Forms.TextBox.1" Then
oInl.Range.Font.Hidden = _
Not oInl.Range.Font.Hidden
End If
Next
End Sub
Make sure,
options, view, show hidden text is set to false.
HTH

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000 (german versions)