![]() |
#1
|
|||
|
|||
![]()
Hello
I am getting Bad File Name Error when Clicked on Listbox of Files. How to get rid of this Error After getting rid of Error Q1. How Can I get No of Pages of Each PDF File in textbox when cliked on listbox of files ? Q2. Any ideas How i can view contents of Each Page no in Userform Image Box ? FYI PDF are opened in MS-Edge. Code:
Option Explicit Dim xRg As Range Dim xStr As String Dim xFd As FileDialog Dim xFdItem As Variant Dim xFileName As String, xFolderPath As String, xFileExtnFilter As String, xStrData As String Dim xFileNum As Long Dim RegExp As Object Dim xWdApp Dim xWd Public Sub DirPathNames() Set xFd = Application.FileDialog(msoFileDialogFolderPicker) With xFd .Title = "Select the Folder..." If .Show = -1 Then xFdItem = xFd.SelectedItems(1) txtFolderPath.Text = xFdItem Else MsgBox "No Folder Path Selected" Exit Sub End If End With xFolderPath = txtFolderPath.Text xFileExtnFilter = "*.PDF" If Dir(xFolderPath & "\" & xFileExtnFilter) = "" Then MsgBox "There are no files of the type:" & vbCrLf & xFolderPath & "\" & xFileExtnFilter Exit Sub Else xFileName = Dir(xFolderPath & "\" & xFileExtnFilter) Do While xFileName <> "" LstfileBx.AddItem xFolderPath & "\" & xFileName xFileName = Dir Loop End If End Sub Private Sub LstfileBx_Click() txtFolderPath.Text = LstfileBx.Text Open txtFolderPath.Text For Binary As #xFileNum xStrData = Space(LOF(xFileNum)) Get #xFileNum, , xStrData Close #xFileNum txtNoOfPAgesPDF.Text = RegExp.Execute(xStrData).Count End Sub 65 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PPT VBA Questions | davidmorse | PowerPoint | 0 | 03-06-2018 09:35 PM |
![]() |
S_jt_C | Word | 1 | 12-05-2015 04:35 PM |
Converting 'comments' into text files (2 questions) | Paul Lance | Word | 1 | 04-29-2013 06:00 PM |
Few questions...needs some help! | Wolf.Stalker | Outlook | 1 | 02-21-2012 09:15 PM |
![]() |
mdc8989 | OneNote | 1 | 02-04-2011 11:47 AM |