0

Hi I have a macro in excel through which I am sending email with default signature of user which I am getting by

Signature = Environ("APPDATA") & "\Microsoft\Signatures\"

its working fine in MSexcel2013 but in 2010 its causing error as 'Cannot find Project or library' on keyword Environ.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Kapil Dhawan
  • 101
  • 1
  • 2
  • 11
  • 2013 uses different outlook references to 2010. Further more, say your workbook is created in 2010; then you open it in 2013 - The references will update to be correct for the 2013, but when going back to 2010 they won't change. Check your references in 2010 - they probably will be missing. If you wanted to be really clever you could have a look at [this](http://stackoverflow.com/questions/9879825/how-to-add-a-reference-programmatically-in-excel-vba) and correct them automatically on the `open` event – Tom Jul 15 '15 at 08:30
  • I need to add signature, client can run it on office 7, 10, 13. For signature I put the above code which is not working in case of 2010 – Kapil Dhawan Jul 16 '15 at 04:42

1 Answers1

0

It looks like you need to add a reference to Microsoft Outlook in Excel.

  • In the Visual Basic Editor, on the Tools menu, click References.
  • Click to select the Microsoft Outlook 14.0 Object Library check box, and then click OK.

See How to automate Outlook from another program for more information.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45