View Single Post
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Gordon Bentley-Mix[_4_] Gordon Bentley-Mix[_4_] is offline
external usenet poster
 
Posts: 82
Default Macro doesn't work


Probably best asked in the VBA newsgroup, but since I'm here...

Two questions:
1. What does the error say?
2. What does the code that creates sFileName look like?
--
Cheers!

Gordon Bentley-Mix

"Kerry" wrote in message
...
I have a macro which saves my Word doc as a pdf based on words within the
document itself. Sometimes I get an error and the macro stops on the
following line:

ActiveDocument.ExportAsFixedFormat OutputFileName:=sFileName, _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False,
OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1,
To:=1, _
Item:=wdExportDocumentContent, IncludeDocProps:=False,
KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True,
_
BitmapMissingFonts:=True, UseISO19005_1:=False

sFileName is a string

If I close out of all my Office apps (Outlook, Word 2007) then reopen Word
and invoke the macro right away, it will work beautifully. I don't know
if
it has to do with the other apps or not, but if I restart everything
fresh,
it works again. Is the problem with the macro or something else?