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
### PERL 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->SaveAs ( { FileName => "$file.html", FileFormat => FormatHTML } ); }

In reply to Win32::OLE Word Macro Conversion by offspinner

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.