Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WordApplication1 won't set CommandBar to Visible

44 views
Skip to first unread message

surfbored

unread,
Aug 1, 2008, 4:57:21 PM8/1/08
to
I'm using the WebBrowser control to open a Word document, and apparently the
default is to not show all of the default toolbars. I figured I could just
go ahead and set the toolbars I wanted to "visible" and move on, but the
code I'm using (below) seems to have no affect. Is there a different way to
make hidden toolbars visible?

procedure TForm1.WebBrowser1DocumentComplete(ASender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
cbStandard: OleVariant;
begin
cbStandard := 1;
with (WebBrowser1.Document AS _Document) do
begin
ActiveWindow.View.ShowAll := False;
ActiveWindow.View.TableGridlines := True;
ActiveWindow.DisplayRulers := False;

WordApplication1.ConnectTo(ActiveWindow.Application);
end;

//Make sure the 'Standard' toolbar is targeted.
ShowMessage(WordApplication1.CommandBars.Item[cbStandard].Name);
//ShowMessage returns 'Standard' successfully.

//Why doesn't this next line work???
WordApplication1.CommandBars.Item[cbStandard].Set_Visible(True);
end;

Thanks,

SB


Jaelani

unread,
Aug 9, 2008, 11:55:46 AM8/9/08
to
Did you check whether it's actually visible by checking its property?
It may be undocked and floating but out of the view.
0 new messages