HostWeb Forums » Microsoft Personal Applications » microsoft.public.word.oleinterop » dsoFramer and the meaning of the universe.
Topic: dsoFramer and the meaning of the universe.
Well, maybe not the meaning of the universe, but I do have some questions
about dsoFramer. I tried to post this once before, but Microsoft made me
verify me email and I think it lost my post in the mix... *sigh*... ok, some
preliminary info:
Using:
Visual Studio 2005
Office 2003
VB.NET
Adding COM Word objects, version 11
I am using the dsoFramer control to display a Word document in my
application. So far its worked great! I haven't run into any problems. I can
save, open, protect, edit, and even send the document to my SQL 2000 database
and get it back again! Its been great! But I have one little question: the
menu bar.
The dsoFramer control does have an option to display a menu bar (boolean
property), and it does work even in the MDI enviroment I have. But it is a
standard windows menu. I was wondering how to get the Word menu bar. Since
the Word menu bar is part of the CommandBars collection, and all of the other
CommandBars (standard, formatting, drawing, etc.) ARE VISIBLE in the
dsoFramer, why can't I get the menu bar?
Now just to prefix that question... I CAN EDIT THE COMMANDBARS! I have done
this. For example, the code below does this:
If Not (TypeOf dsoFramer.ActiveDocument Is
Microsoft.Office.Interop.Word.Document) Then
Exit Function
End If
Dim wordDoc As Microsoft.Office.Interop.Word.Document = Nothing
wordDoc = CType(dsoFramer.ActiveDocument,
Microsoft.Office.Interop.Word.Document)
Dim cb As Microsoft.Office.Core.CommandBar = Nothing
Dim i As Integer = 0
For i = 1 To wordDoc.CommandBars.Count
Try
cb = CType(wordDoc.CommandBars(i), Microsoft.Office.Core.CommandBar)
If cb.Visible = True Then
cb.Visible = False
End If
Catch ex As Exception
'// nothing here
End Try
Next
This DOES work. However if I try the line below:
wordDoc.CommandBars("Menu Bar").Visible = true
Nothing happens. THere is no exception.. just nothing happens. I can examine
the properties of the menu bar...
Msgbox(wordDoc.CommandBars("Menu Bar").Visible)
will display a message box with "True" in it.
Yet, it does not display. What is the difference between the menu CommandBar
and all the others?
Dirk Frulla
Replies below ↓
Replies
RE: dsoFramer and the meaning of the universe.
A follow up:
I have tried using the CustomizationContext of the application object as
well, with no luck.
Dim app as microsoft.office.interop.word.application = ctype(wordDoc.parent,
Word.Application)
app.customizationcontext = wordDoc
app.commandbars("menu bar").visible = true
Not sure why there is a commandbars colleciton in the app and the document,
but the parent of the commandbars always seems to be the app object.
Nothing seems to work yet.... I would be happy about just getting an error
something... any type of response... nothing though. Just doesn't do
anything...
Dirk