Solved

How do I copy macro button from one workbook to another?

Posted on 2014-12-09
2
267 Views
Last Modified: 2014-12-10
I need to copy Sheet1 in Mail.xlsm (attached) to another workbook OtherWorkbook.xlsm. My copy procedure is this - with both workbooks open, I go into Developer/Visual Basic and drag the module/macro from Mail.xlsm to OtherWorkbook.xlsm. I then copy Sheet1 from Mail.xlsm to OtherWorkbook.xlsm.

When I click the button/macro in Sheet1 of OtherWorkbook.xlsm the result is - Compile error: User-defined type not defined. Also, underlying code is displayed with Public Sub CreateAnEmail() highlighted in yellow and the lineDim objOutlook As Outlook.Application highlighted in blue.
Mail.xlsm
0
Comment
Question by:K_Deutsch
2 Comments
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
ID: 40490524
References to additional libraries are not inserted automatically.
After copy you should open (in VBA editor) Tools-References from menu and add reference to proper Outlook library (in my case Microsoft Outlook 14.0):
library
0
 

Author Closing Comment

by:K_Deutsch
ID: 40491780
Works. Thanks for the tip.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now