Macro doesn't work
Wouldn't you know, it's working right now and I don't know how to get it to
replicate the problem, so I don't know exactly what the error says.
The code that creates sFileName is:
sFileName = "C:\Users\Kerry.Atkinson\Documents\" & (year + "-" + base +
"-" + Rank + first + last) & ".pdf"
But like I said the whole macro works beautifully, and when it doesn't, all
I have to do is close out of the apps and it works again. I have noticed,
though, that if I just restart Word but not Outlook, then it still doesn't
work. I have to close out of both for it to work again. I don't know if it
makes a difference, but I'm on Vista.
thanks
"Gordon Bentley-Mix" wrote:
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?
|