i created an userform to automate some emails i need to send everyday, basically i enter the account number and click a lookup button, this brings up the account and contact info from a database i have in excel. then i enter the doc number and amount and click a send button. a file selection window opens and asks me to select the attachment. after selecting an email is created using the info on the user form and the file is attached.
this works ok when i am selecting one file but sometimes i need to select several attachments. i am having trouble with this part, the code i am using lets me select the files but it doesnt actually attach them.
any advice on how i can set it up for multiple attachments? or is there another route i should be taking?
i was thinking that of maybe having the macro write the file names somewhere on the excel file and then using .attachments.add and pointing at whereever excel wrote those files down. but im not sure how to go about that.
anyone have any ideas?
>'open dialog box to let user choose attachment file attachFile = Application _ .GetOpenFilename("Files (*.**), *.**", MultiSelect:=True) Set xOutlookObj = CreateObject("Outlook.Application") Set xEmailObj = xOutlookObj.CreateItem(0) With xEmailObj .Display .To = "" .CC = "" .Subject = "" 'use .HTMLBody to enable signature .HTMLBody = strbody & .HTMLBody .Attachments.Add attachFile End With