Hi there all,

I'm writing a simple script to batch convert word documents into HTML. 
However, I need also to disable the impossibly stupid "Smart Tags" that get 
embedded. The VBA macro below contains the important lines ( .EmbedSmartTags 
= False,  .LabelSmartTags = False). Could anyone give me a clue to getting 
that functionality into the script at the bottom?

Very many thanks!

Richard


###########MACRO
Sub yadda()
'
' yaddaMacro
' Macro recorded 23/11/2004 by Richard Barrett-Small
'
    With Options
        .LocalNetworkFile = False
        .AllowFastSave = True
        .BackgroundSave = True
        .CreateBackup = False
        .SavePropertiesPrompt = False
        .SaveInterval = 10
        .SaveNormalPrompt = False
        .DisableFeaturesbyDefault = False
    End With
    With ActiveDocument
        .ReadOnlyRecommended = False
        .EmbedTrueTypeFonts = False
        .SaveFormsData = False
        .SaveSubsetFonts = False
        .DoNotEmbedSystemFonts = True
        .Password = ""
        .WritePassword = ""
        .DisableFeatures = False
        .EmbedSmartTags = False
        .SmartTagsAsXMLProps = False
        .EmbedLinguisticData = True
    End With
    Application.DefaultSaveFormat = ""
    With autocorrect
        .CorrectInitialCaps = True
        .CorrectSentenceCaps = True
        .CorrectDays = True
        .CorrectCapsLock = True
        .ReplaceText = True
        .ReplaceTextFromSpellingChecker = True
        .CorrectKeyboardSetting = False
        .DisplayAutoCorrectOptions = True
        .CorrectTableCells = True
    End With
    With Options
        .LabelSmartTags = False
        .DisplaySmartTagButtons = True
    End With
End Sub

###SCRIPT

#!C:\Perl\bin\perl5.8.4.exe
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';
system("set PERL5OPT=-MWild");
my $file = $ARGV[0] or die  "Perl says: $!\n\nThis means:\nSyntax 
is...\n\tpq_jnl_conv.pl filename(s)\n";
my $Word = Win32::OLE->new('Word.Application', 'Quit');

while ( $file = shift) {
print "$file.html\n";
# $Word->{'Visible'} = 1;         # if you want to see what's going on
$Word->Documents->Open("$file") || die("Unable to open document $file\n", 
Win32::OLE->LastError());
$Word->ActiveDocument->{EmbedSmartTags} => "False" || die,

$Word->ActiveDocument->SaveAs
    (
        { FileName => "$file.html", FileFormat => wdFormatHTML }
    );
}




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to