Hey guys,
Just having some trouble with some syntax. Basically my excel spreadsheet is sending an email out and I want the clickable button when clicked to ask which attachment should be added, so an open file dialog box.
I have written this code for the file dialog:
Sub Get_Data()
FileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to import", _
FileFilter:="Excel Files *.xls (*.xls),")
''
If FileToOpen = False Then
MsgBox "No file specified.", vbExclamation, "Duh!!!"
Exit Sub
Else
Workbooks.Open Filename:=FileToOpen
End If
End Sub
And the part of my Code that adds the recipient and attachments is:
With olMail
.To = ActiveSheet.Range("A2")
.Subject = "General and Specific comments attached (Word 2007 Format)"
.Body = InputBox("Please enter the Full name of the recipient of this email", "Recipient name") & "attached to thi email are your comments regarding your coursework and exam for the module: Database Administration and management."
.Attachments.Add (Get_Data)
.Display '.Send
End With
Basically, the .Attachments.Add is where I am stuck, you can put a destination path in quotes and that works fine, but I want to run my other sub so that the user can select the file to attach.
Thanks in advance for any replies, info always greatly appreciated! If anyone has an alternative method I'm open to that also! 
Liam
Bookmarks