I'm doing an extraction from a PDF file and pasting it into Excel, which it works great. When I try to process the extracted data I keep getting a 'Run-Time error 1004'
The code I have is the following
Sub PDF_Upload()
    Dim objWord As Object
    Dim objDoc As Object
    Dim wdFileName
    Dim LastRow As Long
    Dim fso As New FileSystemObject
    Dim fileName As String
    fileName = fso.GetFileName("C:\ABC.pdf")
    Title = Replace(fileName, ".pdf", "")
    Set objWord = CreateObject("word.Application")
    wdFileName = "C:\ABC.pdf"
    Set objDoc = objWord.Documents.Open(wdFileName)
    objWord.Selection.WholeStory
    objWord.Selection.Copy
    ' create new sheet and call it the pdf name
    Sheets.Add
    ActiveSheet.name = Title
    [A1].Select
    ActiveSheet.Paste
    ' Close Word
    objDoc.Close SaveChanges:=False
    objWord.Quit
    Application.DisplayAlerts = True
    ' check
    Sheets(Title).Select
    ' process fails in the next line
    LastRow = ActiveSheet.Range("A1").Offset(ActiveSheet.Rows.Count - 1, 0).End(xlUp).Row
End Sub
Everything works until I get to the last line 'LastRow = ActiveSheet....'
Any ideas on what is causing the error. I have look into other posting on 1004 error in StackOverflow (1,2,3,...), but I can not find anything that helps.
