Solved

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

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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;…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 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