Note that there are some explanatory texts on larger screens.

plurals
  1. POPerl Supress Saveas Dialog using Word OLE
    text
    copied!<p>I have a perl script that I am running which uses Microsoft Word OLE and runs spellcheck against the conent I pass to it. I am running into a problem as I am not saving a file or document so when i try and quit word, it wants me to save something (Prompt Save As).</p> <p>I need to be able to supress this message or trick the document into thinking it was already saved. Is this possible or can you think of another solution?</p> <p>I tried DisplayAlerts = 0 and that didnt seem to help either.</p> <pre><code>sub LaunchSpellcheck { #Check the version to see if there are updates. checkVersion(); #Open up MS Word and only display the spellcheck box. my $Word = Win32::OLE-&gt;GetActiveObject('Word.Application') || Win32::OLE-&gt;new('Word.Application'); my @windows = FindWindowLike(undef,"Microsoft Word",""); SetActiveWindow(@windows[0]); $Word-&gt;{'Visible'} = 0; #Add a new document in word my $TmpDocument = $Word-&gt;Documents-&gt;Add(); $TmpDocument = $TmpDocument-&gt;{Content}; #Add contents of clipboard to document $TmpDocument -&gt;{Text} = $clipboard-&gt;GetText(); #Check the spelling $Word-&gt;ActiveDocument-&gt;CheckSpelling; #Set the content of the file back to the clipboard. $clipboard-&gt;Set($TmpDocument -&gt;{Text}); #Hide save as dialog $Word-&gt;{'DisplayAlerts'} = 0; $Word-&gt;Quit; MessageBox('The spellchecked content has been saved to your clipboard.','Spellcheck Complete'); #Log that the tool was used to the global log. TrackUsage(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload