Share via

Excel workbook with VB script not working properly on Win10

Anonymous
2016-10-19T05:20:35+00:00

Hi,

We've got an Excel workbook with a VB script attached to it with some code from the below link:

https://msdn.microsoft.com/en-us/library/ff458119(v=office.11).aspx#odc\_office\_UseExcelObjectModeltoSendMail\_MailingWorkbookasEmailAttachment

The script basically it's introducing a button to convert the workbook in to a PDF file, create a new email, attach the PDF file to the email an populate the To: filed with emails that are present in a cell in the respective active sheet. It does all of that except for populating the To: field with the email address in the respective cell.

The workbook is working just fine when tested on Windows 7 and Office 365 Pro 2016 and 2013 but once I use a Windows 10 OS and any Office 365 2016/2013 the To filed does not populate with the email address.

Below is an excerpt from the VB script that's not working.

 'Create message

    On Error Resume Next

    With OutMail

        .to = ActiveSheet.Range("C17")

        .CC = ""

        .BCC = ""

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-10-20T09:01:41+00:00

    Fantastic. Thank you Jan. That did the trick. Cheers.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-10-20T01:41:07+00:00

    Hi Jan,

    I get the below error after removing that line.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-10-19T07:10:54+00:00

    What happens if you remove the on error resume next? What error message do you get?

    Was this answer helpful?

    0 comments No comments