Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Menu when loading Word from VB App

Status
Not open for further replies.

caguila

MIS
Mar 20, 2002
28
0
0
GB
I am loading a Word document from VB App using createobject, etc. When the document is displayed, (even not in full screen view), all of Word's menu bars/command bars are not visible. Even when attempting to make the commandbars visible using code (either from Word or the document's template, it still isnt working). Any tips?
 
can u post ur code so dat v can inference something out of it?
_
Chan
 
'extract of Code used - how do you get normal Word standard Menus to load automatically
'-------------------------
dim Wapp as application
dim WDoc as word.document
Set WApp = GetObject("", "Word.Application")
If Err.Number <> 0 Then
Set WApp = CreateObject(&quot;Word.Application&quot;)
Err.Clear
On Error GoTo errmsg
End If

Set WDoc = WApp.Documents.Open(&quot;c:\temp\temp.doc&quot;, False)
FileFormat:=0, _
LockComments:=False, Password:=&quot;&quot;, AddToRecentFiles:=True, WritePassword _
:=&quot;&quot;, ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
WApp.WindowState = wdWindowStateMaximize
WApp.ActiveWindow.View.FullScreen = Not ActiveWindow.View.FullScreen
 
Hi caguila!
Made a few changes in ur code to suit ur needs.
u were maximizing the document rather than maximizing the Application. So, u need Word.Application object for that and to view the Word's menu bars and command bars, u need to make the Word.Application Object Visible by setting its Visible property to true.

Here's the modified code -

Dim Wapp As Word.application
Dim WDoc As Word.document
Set Wapp = GetObject(&quot;&quot;, &quot;Word.Application&quot;)
If Err.Number <> 0 Then
Set Wapp = CreateObject(&quot;Word.Application&quot;)
Err.Clear
End If

Set WDoc = Wapp.Documents.Open(&quot;c:\temp.doc&quot;, False)
Wapp.Visible = True

Best of Luck!!!

Best Regards,
_
Chan
 
Brilliant! silly me. Wasn't that simple? didn't realise it wasnt visible yet despite seeing the document. You're a genius.Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top