Cannot run macro in Word 2007

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

maviso5

Thread Starter
Joined
Mar 27, 2008
Messages
1
Hello

In word 2003 (and all other editions) i have always had a macro that runs when i press Ctrl +D, what it does is creates a header, puts my name and the date in it, then closes the header, ready for me to type. However i have just recorded this in word 2007 and i get a debug error "run time error 5941"

If i hit Debug this is what i get.....

Macro2 Macro
'
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveDocument.AttachedTemplate.BuildingBlockEntries(" Blank").Insert _
Where:=Selection.Range, RichText:=True
Selection.TypeText Text:="Daniel Davey 13NB" & vbTab & vbTab
Selection.InsertDateTime DateTimeFormat:="dd/MM/yyyy", InsertAsField:=True _
, DateLanguage:=wdEnglishUK, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub


I have marked in bold where VBA finds a problem and highlights. Can someone please help because this has been driving me barmy!!!

Thanks

Dan
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top