Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function MailFromDir()
Dim wkbToMail As Workbook
Dim strPath As String, strFile As String, strEmail As String
'This is the path where all the files are located
strPath = "Drive:\Folder\"
'Now add the .xls extension to the path
strPath = strPath & "*.xls"
'The first Dir statment needs the full path and extension
strFile = Dir(strPath)
'Keep calling the dir statement until it returns nothing
Do
'Open the workbook to mail
Set wkbToMail = Workbooks.Open(strFile)
'Strip the .xls off the filename
strEmail = Left(strFile, (InStr(strFile, ".") - 1))
'Build the full email address
strEmail = strEmail & "acc@mydomain.com"
'Mail the newly opened workbook
wkbToMail.SendMail strEmail, "Put Subject Here"
'Close the workbook
wkbToMail.Close
'Check for the next workbook to process
strFile = Dir
Loop Until strFile = ""
'Clean up
Set wkbToMail = Nothing
End Function