K
Kamran
Hi All,
In our application we create a Word object using Visual FoxPro 9, set some
properties (like disabling some menu options and enabling a toolbar) and
make a RTF document visible. This was good till Word 2003. Following code
does not work with Word 2007. Word object model seems to be changed in 2007.
'CommandBars()' object is still there in 2007 but does not work. How can I
program to disable options like Save, New, Open etc. for "Office button" as
well as bring 'Review' ribbon with options?
**************** Word 2007 automation in VFP9
LOCAL oWord, llEnabled
oWord=CREATEOBJECT("Word.Application") && Office 2007 is installed
*--
oWord.Documents.Open("c:\temp\test.doc")
llEnabled = .F. &&do not want to enable some menu options
*--
WITH oWord
.CommandBars("File").Controls("Save As...").Enabled=llEnabled
*.CommandBars("File").Controls("Exit").Enabled=llEnabled && Exit is not
available in 2007
.CommandBars("File").Controls("Close").Enabled=llEnabled
.CommandBars("File").Controls("New...").Enabled=llEnabled
.CommandBars("File").Controls("open...").Enabled=llEnabled
*--
.CommandBars("Reviewing").Controls("Track Changes").Enabled=llEnabled &&
on toolbar
.CommandBars("Track Changes").Controls("Track
Changes").Enabled=llEnabled && on right-click menu
* Tracking-Changes Enabled
.CommandBars("Track Changes").Enabled=!llEnabled
.CommandBars("Reviewing").Enabled=!llEnabled && toolbar
.CommandBars("Reviewing").Visible=!llEnabled && toolbar
.CommandBars("Tools").Controls("Track Changes").Enabled=!llEnabled
.CommandBars("View").Controls("Toolbars").Enabled=!llEnabled
* These interfere with right-click-menu
.Options.CheckGrammarAsYouType=llEnabled
.Options.CheckSpellingAsYouType=llEnabled
.Application.Visible=.t.
.Activate()
*--
.Quit()
ENDWITH
*******************************************
TIA
Kamran
In our application we create a Word object using Visual FoxPro 9, set some
properties (like disabling some menu options and enabling a toolbar) and
make a RTF document visible. This was good till Word 2003. Following code
does not work with Word 2007. Word object model seems to be changed in 2007.
'CommandBars()' object is still there in 2007 but does not work. How can I
program to disable options like Save, New, Open etc. for "Office button" as
well as bring 'Review' ribbon with options?
**************** Word 2007 automation in VFP9
LOCAL oWord, llEnabled
oWord=CREATEOBJECT("Word.Application") && Office 2007 is installed
*--
oWord.Documents.Open("c:\temp\test.doc")
llEnabled = .F. &&do not want to enable some menu options
*--
WITH oWord
.CommandBars("File").Controls("Save As...").Enabled=llEnabled
*.CommandBars("File").Controls("Exit").Enabled=llEnabled && Exit is not
available in 2007
.CommandBars("File").Controls("Close").Enabled=llEnabled
.CommandBars("File").Controls("New...").Enabled=llEnabled
.CommandBars("File").Controls("open...").Enabled=llEnabled
*--
.CommandBars("Reviewing").Controls("Track Changes").Enabled=llEnabled &&
on toolbar
.CommandBars("Track Changes").Controls("Track
Changes").Enabled=llEnabled && on right-click menu
* Tracking-Changes Enabled
.CommandBars("Track Changes").Enabled=!llEnabled
.CommandBars("Reviewing").Enabled=!llEnabled && toolbar
.CommandBars("Reviewing").Visible=!llEnabled && toolbar
.CommandBars("Tools").Controls("Track Changes").Enabled=!llEnabled
.CommandBars("View").Controls("Toolbars").Enabled=!llEnabled
* These interfere with right-click-menu
.Options.CheckGrammarAsYouType=llEnabled
.Options.CheckSpellingAsYouType=llEnabled
.Application.Visible=.t.
.Activate()
*--
.Quit()
ENDWITH
*******************************************
TIA
Kamran