VBA - pop-up table to search files

iris1007

New Member
Joined
Jun 28, 2017
Messages
31
Hi,
I have many pdf (now about 4k+ and will be increasing from time to time) which saved in a share folder (F:\). My engineers will always come to me to check if I have the Part pdf in my pdf list.
Can I have a pop-up table for the engineers to input the part # they need for the pdf and if YES, an email will auto send to me.
Thanks in advance for the helps.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Not exactly sure on what is meant by pop up.

This will show an inputbox where they can type the part number, if there's a file on the drive named that it will find and send it.

Otherwise sounds like windows explorer, they can just use that, search then right click and add to email.

Code:
Sub LoopThroughFiles()


Dim StrFile As String
Dim StrFolder As String
Dim aOutlook As Object
Dim aEmail As Object
    
StrFolder = Dir("O\")
StrFile = InputBox("Enter Part Number")
Do While Len(StrFolder & StrFile) > 0
StrFolder = "O:\"
On Error GoTo errorhan
Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)
    aEmail.Importance = 2
    aEmail.Subject = "bla"
    aEmail.Body = "bla"
    aEmail.To = "bla@bla.com"
    aEmail.Attachments.Add StrFolder & StrFile & ".pdf"
    aEmail.Send
Exit Sub
Loop
errorhan:
MsgBox "File not found"
End Sub
 
Last edited:
Upvote 0
Hi,
Thanks for your fast respond. Sorry for the confused.
Yes, your suggestion is exactly what I wanted. Just that, my company is using "LotusNotes" and not "Outlook".

Can I just change :
Set aOutlook = CreateObject("Outlook.Application")

to:
Set aOutlook = CreateObject("Notes.NotesSession")?
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top