Run-time error '4605'

J

jj

I have a template that has been working in word 97 perfect. Now I have
opgraded to office xp (2002), and suddently it is no longer working. When I
run the code it stops here:

With ActiveDocument.PageSetup
.DifferentFirstPageHeaderFooter = False
End With

with the runtime error: 4605.

I have seen somewhere else the it could be something with an protected
document - which had to be unprotected. But I somehow can't get that
working.

Anyone had this problem, and a surgestion what to do?

Everything will be appreciated.

Thanks
JJ
 
J

Jean-Guy Marcil

jj was telling us:
jj nous racontait que :
I have a template that has been working in word 97 perfect. Now I have
opgraded to office xp (2002), and suddently it is no longer working.
When I run the code it stops here:

With ActiveDocument.PageSetup
.DifferentFirstPageHeaderFooter = False
End With

with the runtime error: 4605.

I have seen somewhere else the it could be something with an protected
document - which had to be unprotected. But I somehow can't get that
working.

Anyone had this problem, and a surgestion what to do?

What is the content of the first page header you are trying to access?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

jj

Hi Jean-Guy

I think there is no content so fare.

What happens in the procedure before this error rises is:
first some string variables with name and address are retrieved from the
registry, and then the following code (pasted here)

If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Or
ActiveWindow.ActivePane.View.Type _
= wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If

With ActiveDocument.PageSetup
.DifferentFirstPageHeaderFooter = False
End With

where the error rises on .differentFirstPageHeaderfooter = False

Thanks
JJ
 
D

Default User

4605
Application-defined or object-defined error

What happens if you change this PageSetup property manually?
If a problem arises doing it manually, then it smells like a printer(driver)
issue.
Change the activeprinter, and try to run yr code again.

Krgrds,
Perry
 
J

Jean-Guy Marcil

jj was telling us:
jj nous racontait que :
Hi Jean-Guy

I think there is no content so fare.

What happens in the procedure before this error rises is:
first some string variables with name and address are retrieved from
the registry, and then the following code (pasted here)

If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _ ActivePane.View.Type = wdOutlineView Or
ActiveWindow.ActivePane.View.Type _
= wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If

With ActiveDocument.PageSetup
.DifferentFirstPageHeaderFooter = False
End With

where the error rises on .differentFirstPageHeaderfooter = False

I was asking because if a table is anchored to the first ¶ in the header,
you get strange results.

In your case, however, why are you activating the footer view?
What arte you going to do with the footer:

If you want to insert some text, use:

Dim footerRge As Range

Set footerRge =
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
With footerRge
.Text = SomeVariableString
'or
.Paragraphs(2).Range.Text = SomeVariableString
'etc.
End With

Do not use the selection object with the header/footer pane (or anywhere
else, but especially in that context), it leads to problems.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
D

Default User

4605
Application-defined or object-defined error

What happens if you change this PageSetup property manually?
If a problem arises doing it manually, then it smells like a printer(driver)
issue.
Change the activeprinter, and try to run yr code again.

Krgrds,
Perry
 
J

jj

Hi Jean-guy

I'm only going to put in some text - but i don't no how to set a different
footer on the firstpage if I'm not able to use
"differentFirstPageHeaderfooter"

I have found out that the error is because of a frame I'm using on the
template. If I remove the frame then it works?!

Thanks
JJ
 
J

jj

Hi Perry

Thanks for your answer, but the active printer is the same as in word 97, so
I don't think this can be the problem

/Jj
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top