I have been attaching files to emails which works great but i would
prefer it to rename the file the customer order number
for examples the file added to the email is rptOrder.pdf but i would
like it to include thier order number like Order_13424.pdf
Can this be done
Also is there a way to add more attachement to the email like files
that are sorted on the pc hard drive C:\Documents\Terms.pdf
Thanks
Hm, looks like I forgot to answer last question. I just wrote a
function which will read file names in folder (up to 100 files).
Call it with
fReadFiles("c:\", "pdf")
for .PDF files or without file type parameter to get all the file
names:
fReadFiles("c:\")
before you run code to attach files to Outlook message.
Change the path to desired folder.
Public strFileName(1 To 100) As String
Function fReadFiles(strFolderName As String, _
Optional strFileType As String)
Dim strFileNameLoc As String, i As Integer
For i = 1 To 100
strFileName(i) = ""
Next
If Len(strFolderName) = 0 Then Exit Function
If Right(strFolderName, 1) <> "\" Then
strFolderName = strFolderName & "\"
End If
If Len(strFileType) = 0 Then
strFileNameLoc = Dir(strFolderName & "\*.*")
Else
strFileNameLoc = Dir(strFolderName & "\*." & strFileType)
End If
i = 1
Do While strFileNameLoc <> ""
If (GetAttr(strFolderName & "\" & strFileNameLoc) And vbDirectory)
<> _
vbDirectory Then
If strFileNameLoc <> "." Or strFileNameLoc <> ".." Then
strFileName(i) = strFolderName & strFileNameLoc
i = i + 1
End If
End If
strFileNameLoc = Dir
Loop
End Function
-----
Now you can attach all the PDF files in selected folder to Outlook
message using solution from my previous post. There is no error
handling.
Regards,
Branislav