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!

How do I? : Minimise or autohide Word ribbon with from access with VBA 1

Status
Not open for further replies.

thefarg

Programmer
Jan 25, 2012
94
NZ
I am using word to preview some .docx documents from Access 2007.
My Current sub ...
Code:
'Word Document handling
[COLOR=green]'Previews word document(s) from named path[/color]
Public Sub PreviewWordDoc(WordDocFullPath As String, Optional Orientation As String = "Portrait")
    Dim objWord As Word.Application
    
    Set objWord = New Word.Application
        With objWord
            .Documents.Open filename:=WordDocFullPath, readOnly:=True
                If Orientation = "Landscape" Then
                    .ActiveDocument.PageSetup.Orientation = wdOrientLandscape
                    .width = 450
                    .height = 450
                Else
                    .ActiveDocument.PageSetup.Orientation = wdOrientPortrait
                    .width = 325
                    .height = 575
                End If
            .DisplayScrollBars = False
            .ActiveDocument.ActiveWindow.View.zoom.Percentage = 50
  [COLOR=green]          '.ActiveDocument.ActiveWindow.Panes(1).Zooms(wdPrintView).PageFit = wdPageFitFullPage
            '.CommandBars.item("Ribbon").Visible = False [/color]
            .windowState = wdWindowStateNormal
            .Visible = True
            .Activate
        End With
End Sub
I have tried to hide Word's ribbon with
Code:
.CommandBars.item("Ribbon").Visible = False
and several other simular. How can I make the ribbon autohide or minimise?
 
What about this ?
.ActiveWindow.ToggleRibbon

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
try

.Application.StatusBar = False

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
Word Developer Reference
StatusBar Property
This property is no longer supported in Microsoft Word Visual Basic for Applications
PHV - .ActiveWindow.ToggleRibbon works first time....and third, fifth etc. It does as it says, it is a toggle. Any way of setting ribbon state to default instead of as it was last saved?
 
what version of word are you using

Application.CommandBars(“Status Bar”).Visible = False

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
Works great, thanks. I'm using Word 2007. Any idea how to reset all the commandbars to default? I'm still not having much luck with the Ribbon, I can toggle it, but then its only the way I want it 50% of the time ;) Perhaps there is a way to find if the bar is hidden?
 
in the on close event reverse the process


HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
what you might try is to check to see the ribbon height is > 56 then toggle and reverse it on close. I believe the minimized hieght is 56 and max is 147

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
if its always 0 then your not doing it right :) try again

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top