Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
This code works but I just need Pdf file how can I alter it so it just collect certain files
VBA Code:
Private Sub Fill_DrNumbers_Click()
Dim FSOLibary As FileSystemObject, FSOFolder As Object, FSOFile As Object
Dim FolderName As String
Dim SourcePath As String
Dim SubPath As String
Dim PdfFolder As Folder
Dim PdfFile As String
Dim MyPath As String
Dim PDFFName As String
Dim CmbData
CmbData = Split(Me.OpenDrawing.Value, "-")
CmbData(0) = Replace(CmbData(0), "-", "")
MyPath = "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe"
SourcePath = "\\dc01\Company\R&D\Drawing Nos"
SubPath = CStr(Val(Int(CmbData(0) / 50) * 50 + 1) & "-" & Int(CmbData(0) / 50 + 1) * 50)
Me.PdfDrawingList.Clear
FolderName = (SourcePath & "\" & SubPath & "\" & Int(CmbData(0)))
Set FSOLibary = New Scripting.FileSystemObject
Set FSOFolder = FSOLibary.GetFolder(FolderName)
Set FSOFile = FSOFolder.Files
For Each FSOFile In FSOFile
Me.PdfDrawingList.AddItem FSOFile.Name
Next
End Sub