Hello,
I have this macro that is stored in Microsoft Outlook to send out emails, it works perfectly fine for me but not for my new colleague.
The only requirement is to have the excel file LOG 2.xlsm open before running it.
For my colleague it stops here and will not work unless she restarts her PC.
The file is saved in the same location for all of us and she is using the same version of Excel.
I am using the below references:
Visual Basic for Applications
Microsoft Outlook 16.0 Object Library
Microsoft Office 16.0 Object Library
Microsoft Excel 16.0 Object Library
Microsoft Scripting Runtime
Accessibility CpIAdmin 1.0 Type Library
Any idea is much appreciated!! Thank you
I have this macro that is stored in Microsoft Outlook to send out emails, it works perfectly fine for me but not for my new colleague.
The only requirement is to have the excel file LOG 2.xlsm open before running it.
For my colleague it stops here and will not work unless she restarts her PC.
Code:
Set wb = myXL.Workbooks("LOG 2.xlsm") '<-- Wb already open. Rename as appropriate
The file is saved in the same location for all of us and she is using the same version of Excel.
I am using the below references:
Visual Basic for Applications
Microsoft Outlook 16.0 Object Library
Microsoft Office 16.0 Object Library
Microsoft Excel 16.0 Object Library
Microsoft Scripting Runtime
Accessibility CpIAdmin 1.0 Type Library
Any idea is much appreciated!! Thank you
VBA Code:
Option Explicit
Sub Send_Email_to_Investors()
Dim olMsg As MailItem
Set olMsg = ActiveExplorer.Selection.Item(1)
Email_to_Investors
lbl_Exit:
Set olMsg = Nothing
Exit Sub
End Sub
Sub Email_to_Investors()
Dim myMail As Outlook.MailItem
Dim wb As Excel.Workbook 'Early bind - needs a reference to Excel
Dim myXL As Excel.Application 'Early bind - needs a reference to Excel
Dim mySh As Worksheet
Dim myBody, Signature, sPath As String, strFile As String, strFolderPath As String, ext As String
Dim oAttachments As Outlook.Attachments
Dim StrSignature, signImageFolderName, completeFolderPath As String
Dim strLocation, strFileName, strFileExt, strFileName1, strFileExt1, pass As String
Dim i As Long, fCol As Long, lCol As Long, iCount As Long
Dim stExport As Variant
Dim sFolder As String
Dim aFolders() As Variant
Dim iFolderCount As Integer
Set myXL = GetObject(, "Excel.Application") 'Excel already running
Set wb = myXL.Workbooks("LOG 2.xlsm") '<-- Wb already open. Rename as appropriate