I get "Object variable or With block variable not set" error
I get the error described in the title when executing the code beneath. Any help would be appreciated.
VB Code:
Public Sub AutoNew()
Dim PlayName
PlayName = InputBox("Enter Name of Play", "Name of Play")
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
Selection.TypeText Text:=PlayName & vbTab & vbTab
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
Port
Re: I get "Object variable or With block variable not set" error
Re: I get "Object variable or With block variable not set" error
It does not provide a line number. I just get a message box that appears with the error message. i'm new to VBA and VB in general, but am an experienced programmer in other languages.
Is there a way to get a more detailed message?
Port
Re: I get "Object variable or With block variable not set" error
it wont provide line numbers.. but it should highlight the line showing the error.