Error 5151 and 5479 on Word2007

Robie
5StarLounger
Posts: 656
Joined: 18 Feb 2010, 14:26

Error 5151 and 5479 on Word2007

Post by Robie »

Hi

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
Any help, pointer to the right direction highly appreciated.

User avatar
HansV
Administrator
Posts: 78600
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Error 5151 and 5479 on Word2007

Post by HansV »

Are you running this code within Word or from another application?
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78600
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Error 5151 and 5479 on Word2007

Post by HansV »

Another thing: have you installed the Office Live add-in? If so, try disabling or uninstalling it.
Best wishes,
Hans

Robie
5StarLounger
Posts: 656
Joined: 18 Feb 2010, 14:26

Re: Error 5151 and 5479 on Word2007

Post by Robie »

HansV wrote:Are you running this code within Word or from another application?
Running it from within Word. What I have noticed is that I get error 5479 if I create the document from another Word application, i.e. New|select template etc. But, if I just double-click on the template from Windows Explorer than I *don't* get this error. Strange.

BTW: Error 5151 has disappeared now. I had to restart my PC - unrelated to this issue. This seems to have fixed it.
HansV wrote:Another thing: have you installed the Office Live add-in? If so, try disabling or uninstalling it.
Don't know what Office Live add-in is :-(. Office 2007 is installed by technical services in the company. I will look into it though. Thanks.