We help IT Professionals succeed at work.

Opening Word from VBA without ribbon

yballan
yballan asked
on
Dear Experts,

I am writing Access Database, which previews HTML code in Word.   Here is the code I am using:

    Set wordapp = CreateObject("word.Application")
    wordapp.Documents.Open FileName:="C:\ECEditor\prvWin.html", ReadOnly:=True
    wordapp.Visible = True

When I open the file, I would like to disable (or not display) the ribbon, so that the user knows that it is only meant for preview.
Is there such switch/parameter?
Please advisel.
Comment
Watch Question

Top Expert 2016

Commented:
Hi,

pls try

CommandBars.ExecuteMso "MinimizeRibbon"

Open in new window

Regards
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
According to http://wordribbon.tips.net/T008515_Minimizing_the_Ribbon_for_a_Document.html, the only reliable way is to use   ActiveWindow.ToggleRibbon   for the Application object.
Martin Liss"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
What about using the Word Viewer instead of Word itself?

Author

Commented:
Dear Martin Liss,

Thank you for your reply.

I am trying to sell this application, would the user also have to download Word Viewer?

Author

Commented:
This worked great!  Thank you!!
Martin Liss"There is still no cure for the common birthday." ~John Glenn
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
...would the user also have to download Word Viewer?
It's a free app so I assume that you can distribute it, but that's something you'd have to verify with Microsoft.
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
Didn't look it up, but usually you may not redistribute, but require a download on the target site.