CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
MS Word OLE Supress Save As Dialog

 



sbbcarl
New User

Oct 28, 2013, 7:38 AM

Post #1 of 1 (104 views)
MS Word OLE Supress Save As Dialog Can't Post

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).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?

I tried DisplayAlerts = 0 and that didnt seem to help either.

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->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application');
my @windows = FindWindowLike(undef,"Microsoft Word","");
SetActiveWindow(@windows[0]);
$Word->{'Visible'} = 0;

#Add a new document in word
my $TmpDocument = $Word->Documents->Add();
$TmpDocument = $TmpDocument->{Content};
#Add contents of clipboard to document
$TmpDocument ->{Text} = $clipboard->GetText();

#Check the spelling
$Word->ActiveDocument->CheckSpelling;
#Set the content of the file back to the clipboard.
$clipboard->Set($TmpDocument ->{Text});

#Hide save as dialog
$Word->{'DisplayAlerts'} = 0;
$Word->Quit;

MessageBox('The spellchecked content has been saved to your clipboard.','Spellcheck Complete');

#Log that the tool was used to the global log.
TrackUsage();
}

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives