Eric Penfold
Active Member
- Joined
- Nov 19, 2021
- Messages
- 431
- Office Version
- 365
- Platform
- Windows
- Mobile
The codes open a Email find but can`t seem to grab any files?
VBA Code:
Private Sub Email_Files_Click()
Dim objol As Object
Dim objmail As Object
Dim objFolder As Object
Dim fso As Object
Dim fsFolder As Object
Dim fsFile As Object
Dim strFolder As String
Dim strFile As String
Dim MyPath As String
Dim Pdf As String
Dim DXF As String
Dim SubPath As String
Dim PDFFName As String
Dim DXFFName As String
Dim CmbData
CmbData = Split(Me.OpenDrawing.Value, "-")
CmbData(0) = Replace(CmbData(0), "-", "")
SourcePath = "\\dc01\Company\R&D\Drawing Nos"
SubPath = CStr(Val(Int(CmbData(0) / 50) * 50 + 1) & "-" & Int(CmbData(0) / 50 + 1) * 50)
strFolder = (SourcePath & "\" & SubPath & "\" & OpenDrawing.Value)
strFile = Dir(strFolder & "*.pdf")
Set objol = CreateObject("Outlook.Application")
Set objmail = objol.CreateItem(0)
With objmail
.to = "darren@drainfast.co.uk"
.cc = ""
.BCC = ""
.Subject = "All Files to Send" & Format(Date, "mm/dd/yyyy")
.Display
.HTMLBody = "Please see Attached files to Process <p>" & _
"And or Please see Attached files to Quote for"
Do While strFile <> ""
.Attachments.Add strFolder & strFile
strFile = Dir
Loop
End With
errhndl:
Set objFolder = Nothing
Set fso = Nothing
Set fsFolder = Nothing
Set objol = Nothing
Set objmail = Nothing
End Sub