Results 1 to 3 of 3

Thread: converting Word macro to VB[RESOVLED]

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2004
    Posts
    37

    converting Word macro to VB[RESOVLED]

    I have this macro from word i would like to use in VB, but there are a few things that i cant get to work.. first you see the macro as it looked in Word..

    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
    If Selection.HeaderFooter.IsHeader = True Then
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    NormalTemplate.AutoTextEntries("Side X af Y").Insert Where:=Selection. _
    Range, RichText:=True
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument


    and this is what i would think it should look like in VB..

    If wrdDoc.ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    ActiveWindow.Panes(2).Close
    End If
    If wrdDoc.ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
    ActivePane.View.Type = wdOutlineView Then
    ActiveWindow.ActivePane.View.Type = wdPrintView
    End If
    wrdDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    If wrdDoc.Selection.HeaderFooter.IsHeader = True Then
    wrdDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
    wrdDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    wrdDoc.NormalTemplate.AutoTextEntries("Side X af Y").Insert Where:=Selection. _
    Range, RichText:=True

    wrdDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

    the blue lines is where it fails..

    what the macro is doing is Page numbers with one of the autotext formats.

    Anyone know what the problem might be ?

    Best regards

    Garnet
    Last edited by Garn; May 28th, 2004 at 05:35 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width