Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-24-2021, 05:41 PM
SamDsouza SamDsouza is offline Just Two Questions on PDF Files Windows 10 Just Two Questions on PDF Files Office 2013
Advanced Beginner
Just Two Questions on PDF Files
 
Join Date: Aug 2019
Posts: 71
SamDsouza is on a distinguished road
Default Just Two Questions on PDF Files

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
SamD
65
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
PPT VBA Questions davidmorse PowerPoint 0 03-06-2018 09:35 PM
Just Two Questions on PDF Files Questions 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
Just Two Questions on PDF Files onenote offline cache files questions mdc8989 OneNote 1 02-04-2011 11:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft