Recognize file format

A

assaf1978

Hi,
I have activeX checkboxes in my document. I would like to make them
disabled, once I save the file in HTML format.
How do I recognize the file format?
I assume I need VBA for this.

Thanks,
Assaf.
 
C

Cindy M.

Hi Assaf1978,
I have activeX checkboxes in my document. I would like to make them
disabled, once I save the file in HTML format.
How do I recognize the file format?
I assume I need VBA for this.

Could you please provide more information about what you need to do?
More specifically

1. Version of Word

2. Which type of "HTML format" is involved (what file type do you
select in File/Save As)?

3. Where (in what application) do you expect this "HTML format" file
to be opened? And the checkboxes are still active?

4. Usually, dynamic changes to the state of ActiveX controls embedded
in a document are not saved when the document is closed and re-opened
(not matter which file format). So I have my doubts that "disabling"
them is going to work. Therefore:
- is there a reason you're using ActiveX checkboxes rather than
formfield checkboxes?

- What would be an acceptable replacement for the checkboxes when
saved to "HTML format"?

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 :)
 
A

assaf1978

Hi Cindy,
I'm using word 2007. I tried to save as .mht (single file).
I need to open this in microsoft internet explorer.

I'm not restricted to the checkbox (which changes to it are saved when I
open the document again after closing - no matter which format), but I tried
to use formfield checkboxes but they don't appear in mht/html.
I could care less which checkbox I use.

Thanks!
Assaf
 
C

Cindy M.

Hi Assaf1978,
I'm using word 2007. I tried to save as .mht (single file).
I need to open this in microsoft internet explorer.

OK, I see now what you're talking about.

The following code will loop through the document and disable
all checkbox controls:

Sub DisableActiveXObjects()
Dim doc As Word.Document
Dim ils As Word.InlineShape
Dim shp As Word.Shape

Set doc = ActiveDocument
For Each ils In doc.InlineShapes
DisableActiveX ils
Next
For Each shp In doc.Shapes
DisableActiveX shp
Next
End Sub

Sub DisableActiveX(oShp As Object)
Dim ctl As MSForms.Control
Dim chk As MSForms.CheckBox

If oShp.Type = msoFreeform Then '5
'In case the type isn't a checkbox. Avoids "Type
mismatch" error.
On Error Resume Next
Set chk = oShp.OLEFormat.Object
On Error GoTo 0
If Not chk Is Nothing Then
chk.Enabled = False
End If
End If
End Sub

The question is, when/how should it be triggered. Can you
explain a bit more how you expect such documents to be used?
What kind of steps do you think users will be following when
they work with such a document?

You could, for example, replace Word's built-in Save As
command with your own. It would also be possible to have a
separate button for saving as a web-page...

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

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