Solved

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

Posted on 2014-12-09
2
255 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

757 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

21 Experts available now in Live!

Get 1:1 Help Now