1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Cannot run macro in Word 2007

Discussion in 'Business Applications' started by maviso5, Mar 27, 2008.

Thread Status:
Not open for further replies.
  1. maviso5

    maviso5 Thread Starter

    Mar 27, 2008

    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
    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, _
    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!!!


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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/697532

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice