• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Problem with macro to send e-mail from excel workbook

aleksandra123

New Member
I am new to VBA and I have macro to send e-mail from excel workbook. Macro creates a separate files and send it to the recipients. Unfortunately in the main workbook there are a connections between worksheets as this [Templates.xlsm]CM'!BM23
and they also appear in the new created files which I sent to the recipients but I don't want this. Is there a possibility to change this? I want to have in new created file only values and formats of numbers. Please help.
I upload the whole macro too.
 

Attachments

Easiest method is to create copy of the workbook with connections.

Open the copy, run something like below to kill all connections on copied workbook before you run email code on same copied workbook.
Code:
Sub removeconnections()
Dim xConnect As Object
For Each xConnect In ActiveWorkbook.Connections
If xConnect.Name <> "ThisWorkbookDataModel" Then xConnect.Delete
Next xConnect
End Sub

Code originally from:
https://social.technet.microsoft.co...e-all-data-connections-excel-2013?forum=excel
 
Back
Top