I am getting these two errors
5151 when trying to add a new document using a specific template
5479 when searching for a list of word documents
I don't understand why as all this used to work fine until today (I have just come back from a holiday). This has worked fine for past couple months. I re-checked Word options and made sure the folder where the template exists is part of the trusted location, etc. I am new to Word 2007 so not sure what else should I check for.
Anyway, the code I run is as follows:
Code: Select all
Error 5479 on the line if .Show = 0 Then ...
With Dialogs(wdDialogFileOpen) ' Select and open the file to convert
.Name = "*.doc"
WordBasic.DisableAutoMacros 1
If .Show = 0 Then ' if convert from file selection
WordBasic.DisableAutoMacros 0
Exit Function ' cancelled - exit conversion process
End If
WordBasic.DisableAutoMacros 0
End With
Error 5151 on the line Documents.Add ... The template pointed by ImpTemplate exists and can be loaded in the normal way through Word new/open etc options.
WordBasic.DisableAutoMacros 1
Documents.Add Template:=ImpTemplate
WordBasic.DisableAutoMacros 0