Vin_Ramdeen
11-23-2015, 12:40 PM
Hi All,
I have a VBA macro in Excel which searches through an Excel workbook to check whether or not a specific department is present in the workbook. The macro searches along the header row of the first worksheet, looks for the "Department" column header and then searches down this column to see if a specified department(s) is found. If the department(s) is not present in the worksheet, the macro moves on to the next worksheet and repeats the process until all worksheets have been checked.
If the department(s) are not present in the workbook, the macro ends and nothing further happens. However, if the department(s) are present in the workbook, in any of the worksheets, under any of the "Department" columns, a message box pops up with a warning letting the user know that they are present and vbYesNo asks if the user would like to continue.
The macro is a subroutine I would like to implement when the user is sending e-mails with Excel attachments via Outlook. As an error-checking stage, I would like to use the Outlook ItemSend event when the "Send" button is pressed to search the e-mail for Excel attachments, and if present, run the code which searches the Excel files attached. If the specified department(s) is present in the file, I would like a warning/prompt to pop-up asking the user if they would like to continue sending the e-mail or not. If yes, the Outlook send event continues and the e-mail is sent. If no, the Outlook send event is terminated and the user can then decide what to do next.
From scouring the Internet, I have found code which checks if attachments have been included, opens attachments, saves attachments, and even sends the attachments to specific locations when e-mails are received, but have yet to find anything that checks attachment content prior to sending. Your help would be greatly appreciated.
Cheers,
Vin
I have a VBA macro in Excel which searches through an Excel workbook to check whether or not a specific department is present in the workbook. The macro searches along the header row of the first worksheet, looks for the "Department" column header and then searches down this column to see if a specified department(s) is found. If the department(s) is not present in the worksheet, the macro moves on to the next worksheet and repeats the process until all worksheets have been checked.
If the department(s) are not present in the workbook, the macro ends and nothing further happens. However, if the department(s) are present in the workbook, in any of the worksheets, under any of the "Department" columns, a message box pops up with a warning letting the user know that they are present and vbYesNo asks if the user would like to continue.
The macro is a subroutine I would like to implement when the user is sending e-mails with Excel attachments via Outlook. As an error-checking stage, I would like to use the Outlook ItemSend event when the "Send" button is pressed to search the e-mail for Excel attachments, and if present, run the code which searches the Excel files attached. If the specified department(s) is present in the file, I would like a warning/prompt to pop-up asking the user if they would like to continue sending the e-mail or not. If yes, the Outlook send event continues and the e-mail is sent. If no, the Outlook send event is terminated and the user can then decide what to do next.
From scouring the Internet, I have found code which checks if attachments have been included, opens attachments, saves attachments, and even sends the attachments to specific locations when e-mails are received, but have yet to find anything that checks attachment content prior to sending. Your help would be greatly appreciated.
Cheers,
Vin