When I run the code below I'm getting a runtime error 462 and I can't find my error (other than my code is sloppy) I'm very new with VBA..
Code:
Private Sub CommandButton2_Click()
Sheets("AHLTA").Visible = True
Sheets("AHLTA").Select
ActiveSheet.Cells.EntireColumn.Hidden = False
ActiveSheet.Range("A1:I1").Select
ActiveSheet.Range("I1").Activate
Selection.AutoFilter
ActiveSheet.Range("$A$1:I50").AutoFilter Field:=8, Criteria1:= _
xlFilterToday, Operator:=xlFilterDynamic
ActiveSheet.Range("A1:I50").Select
Selection.Copy
'to make the word document
Dim wdApp As Word.Application, wdDoc As Word.Document
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wdDoc = wdApp.Documents.Open("G:\Information Management (Restricted)\Training\trial\Sign In Final.doc")
With wdDoc
wdApp.Visible = True
wdApp.Selection.PasteAndFormat (wdPasteDefault)
wdApp.ActiveWindow.View.ShowXMLMarkup = wdToggle
wdApp.ActiveDocument.ToggleFormsDesign
wdApp.ActiveWindow.View.ShowXMLMarkup = wdToggle
wdApp.ActiveDocument.ToggleFormsDesign
wdApp.Selection.Tables(1).AutoFitBehavior (wdAutoFitWindow)
With ActiveDocument.PageSetup
.Orientation = wdOrientLandscape
Set wdDoc = Nothing
Set wdApp = Nothing
End With
End With
End Sub