Professional Documents
Culture Documents
PageCount = pdfReader.NumberOfPages
End Using
Try
Dim isFileOpen As Boolean = FileOpenTest(strFilePath)
PageCount = objExcel.Worksheets.Count
Else
objExcel = New Excel.Application
objWorkbook = objExcel.Workbooks.Open(strFilePath)
objExcel.DisplayAlerts = False
PageCount = objExcel.Worksheets.Count
objWorkbook.Close(SaveChanges:=False)
objExcel.ScreenUpdating = True
objExcel.Application.Quit()
Return strResult
Catch ex As Exception
If Err.Number = 429 Then MessageBox.Show("Unable to find to
selected document in the specified path/drive.", "Missing Document",
MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return strResult
End Try
'Acquired separately as getting data from word files take time; run
through background worker
Case ".doc", ".docx"
Dim objWordApp As Object = Nothing
Dim objDoc As Object = Nothing
Dim isFileOpen As Boolean = FileOpenTest(strFilePath)
Else
objWordApp = CreateObject("Word.Application") 'New
Word.Application
objDoc = objWordApp.Documents.Open(strFilePath)
PageCount =
objDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages)
intHeight = objDoc.ActiveWindow.Panes(1).Pages.Item(1).Height
intWidth = objDoc.ActiveWindow.Panes(1).Pages.Item(1).Width
objDoc.Close(SaveChanges:=False)
objWordApp.Application.Quit()
End If
PageCount = theTIFF.GetFrameCount(FrameDimension.Page)
theTIFF.Dispose()
i += 1
Next
Return strResult
End Function