Link to home
Start Free TrialLog in
Avatar of Chris Wilson
Chris Wilson

asked on

I have created a excel workbook which has VBA to open up in outlook yet it does not work on Outlook 2016. Please can you help?

I have recently created a quotation tool which opens up into outlook when the quote is built as a screenshot to send to a customer. I have tested it on my system and it works perfectly, yet I have sent it to a colleague who uses windows 10 (im on 8) and Office 2016 (im on 2013) and it does not work. It just says the location inst available. Please can someone help me with this. I have attached the excel document created.
Quotation-test.xlsm
Avatar of Rgonzo1971
Rgonzo1971

HI,

pls try
Private Sub CommandButton1_Click()
    'Copy range of interest
    Dim r As Range
    Set r = Range("A1:J23")
    r.Copy

    'Paste as picture in sheet and cut immediately
    Dim p As Object
    Set p = ActiveSheet.Pictures.Paste
    p.Cut

    'Open a new mail item
    Dim outlookApp As Object
    Set outlookApp = CreateObject("Outlook.Application")
    Dim outMail As Object
    Set outMail = outlookApp.CreateItem(0) '

    'Get its Word editor
    outMail.Display
    Dim wordDoc As Object
    Set wordDoc = outMail.GetInspector.WordEditor

    'Paste picture
    wordDoc.Range.Paste
    wordDoc.InlineShapes.Item(1).ScaleHeight = 100
    wordDoc.InlineShapes.Item(1).ScaleWidth = 100
End Sub

Open in new window

Regards
Avatar of Chris Wilson

ASKER

Hi,

This works on my machine but again not my colleagues on Windows 10. I sent it to another colleague on windows 10 and it doesnt work there neither. Can you let me know what i need to do? It highlights line 16 (olMailItem) in yellow when it tries to run the debug?
SOLUTION
Avatar of Dustin Saunders
Dustin Saunders
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Yes I have checked the references and VB is selected. More than is probably required are ticked but it works for me on Office 2013 but not the new windows. Thank you for the above code i will check it and let you know.
I have checked the code and it didnt work but i managed to play around with the settings and it did in the end. Hwever there are 5 sheets in total on the workbook which it needs to copy and paste into the Excel sheet and it is now only pasting the first sheet. Can anyone help with this. The original coding in the excel sheet I attached pasted all 5 sheets in the same email. Please can you take a look at it for me.
I think you should open a new question since teh scope is not the same do not forget to add examples