Textbox visible property does not work within Word document

D

dod

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
 
C

Cindy M.

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
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?
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 :)
 
H

Helmut Weber

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top