Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

Disable "Disable Features Introduced After" if currently enabled.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sharat Koya - 18 Apr 2007 08:38 GMT
Hi, I was referenced to here from the VBA group as I have been trying to
disable the "Disable Features Introduced After" option in word but it has had
side effects. Please can someone help me with the following..

-------
Ok that works great in the VBA when the document is open. I am also
attempting to disable the feature before my document gets launched from C#
using Interop.

I can sucessfully create the document:
-Microsoft.Office.Interop.Word.Document doc = word.Document.Open(ref
wordFilePath,     ...... );

I then check to see if "Disable features introduced after" is enabled and
disable it:
-if (word.Options.DisableFeaturesbyDefault)
- {
-  doc.DisableFeatures = false;
-  word.Options.DisableFeaturesbyDefault = false;
-  doc = null;                        
-}

I then open the document where I don't want "Disable features introduced
after" enabled:

-doc = word.Documents.Open(ref wordFilePath, ...);

I then use the doc.SaveAs command to save as a word document as the original
was a template:
-object docFormat = WdSaveFormat.wdFormatDocument;
-doc.SaveAs(ref wordFilePath, ref docFormat, ref missing ...);

When I trace through this code both
word.Options.DisableFeaturesbyDefault and doc.DisableFeatures are false.

As soon as the document is saved using doc.SaveAs the doc.DisableFeatures
property gets set to true and any subsequent document has the "Disable
Features introduced after" enabled. Should this happen when using the SaveAs
features?

I am guessing that the SaveAs method retrieves older settings from the
registry under
\\HK Current User\Software\Microsoft\Office\11.0\Word\Data as deleting this
key and then restarting Word disables the option and looses all compatibility
options.

Is there another method of disabling the feature without side effects?

thanks for any time spent on this,

"Jay Freedman" wrote:

> It looks like you'll have to do both. This works here (Word 2003):
>
> Options.DisableFeaturesbyDefault = False
> With ActiveDocument
>     .DisableFeatures = False
>     .Compatibility(wdDontUseHTMLParagraphAutoSpacing) = False
> End With
>
> > For sure, but how can I disable the "disable features introduced
> > after" option without enabling "Don't use HTML paragraph auto
> > spacing" or do I have to disable both - one after another?
> >
> > "Jay Freedman" wrote:
> >
> >> The disabled-features items have little or nothing to do with the
> >> compatibility options. The code you want for this is
> >>
> >> ActiveDocument.Compatibility(wdDontUseHTMLParagraphAutoSpacing) =
> >> False
> >>
> >> This statement has to run after the document in question has been
> >> opened. If you save the document after that, the option will be saved
> >> in the document's file; you wouldn't have to set it again, although
> >> it won't do any harm to do so.
> >>
> >> --
> >> Regards,
> >> Jay Freedman
> >> Microsoft Word MVP        FAQ: http://word.mvps.org
> >> Email cannot be acknowledged; please post all follow-ups to the
> >> newsgroup so all may benefit.
> >>
> >> On Mon, 16 Apr 2007 04:44:02 -0700, Sharat Koya
> >> <SharatKoya@discussions.microsoft.com> wrote:
> >>
> >>> Hi I have tried to use the following line of code to disable the
> >>> feature "Save Word files as" option in Word options on document
> >>> open:
> >>>
> >>> Word.Options.DisableFeaturesbyDefault = False
> >>>
> >>> by using this I was hoping to disable stop the option from
> >>> renabling with older documents also.
> >>>
> >>> I also added the following line :
> >>> Me.DisableFeatures = False
> >>>
> >>> However when I launch the document the Compatibility Option "Don't
> >>> use HTML paragraph auto spacing" is checked which alters the
> >>> location of some of word content.
Cindy M. - 18 Apr 2007 17:27 GMT
Hi =?Utf-8?B?U2hhcmF0IEtveWE=?=,

> I then open the document where I don't want "Disable features introduced
> after" enabled:
[quoted text clipped - 5 lines]
> -object docFormat = WdSaveFormat.wdFormatDocument;
> -doc.SaveAs(ref wordFilePath, ref docFormat, ref missing ...);

Don't do this. Use the Documents.Add rather than Open method to create a
document from a template. That might also make a difference for the problem
you're more concerned about :-)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
Sharat Koya - 19 Apr 2007 14:56 GMT
There is a bug in word it seems that hasn't got a resolution yet:

http://support.microsoft.com/kb/832349

do you think using documents.add will resolve the issue and if so why?

thanks for your time

Sharat

> Hi =?Utf-8?B?U2hhcmF0IEtveWE=?=,
>
[quoted text clipped - 19 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
Cindy M. - 19 Apr 2007 18:20 GMT
Hi Sharat,

> There is a bug in word it seems that hasn't got a resolution yet:
>  
> http://support.microsoft.com/kb/832349 
>  
> do you think using documents.add will resolve the issue and if so why?

Thanks for information about the bug. Given this, no, I don't think
using Documents.Add will change that. But you should use it, anyway :-)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.