philwinfield
New Member
- Joined
- Feb 13, 2023
- Messages
- 3
- Office Version
- 2019
- Platform
- Windows
Hi have sheet that new members for a club are pasted into and then a PDF file is created from a Word template for the membership card and this is then attached to an email all automated from Excel & it saved a LOT of time!
It's stopped working and I am desperate to get it going again but have no idea what this means and I have done a fair bit of searching online:
It's stopped working and I am desperate to get it going again but have no idea what this means and I have done a fair bit of searching online:
VBA Code:
Sub Send_emails()
Dim olApp As New Outlook.Application
Dim mItem As Outlook.MailItem ' An Outlook Mail item
Dim msgBody As String
Set olApp = CreateObject("Outlook.Application")
On Error GoTo 0
lastRow = Range("A1").End(xlDown).Row
For r = 2 To lastRow ' each row
Debug.Print Range("E" & r) ' email
Debug.Print Range("A" & r) ' membership number
Debug.Print Range("D" & r) ' classes
Debug.Print Range("B" & r) ' full name
If Range("A" & r) = "" Then GoTo TheEnd
Set mItem = olApp.CreateItemFromTemplate("C:\Users\philw\My Drive\Development\U3A\Membership Card Code\Welcome to Poole U3Av3.msg") ' [COLOR=rgb(0, 168, 133)]This fails with a 58 the file is already there. What file? Can I find and delete it?[/COLOR]