Solved

Excel Macro Error when trying to print

Posted on 2011-09-27
5
190 Views
Last Modified: 2012-05-12
I have an excel sheet and have created a Macro to do the following 3 steps:
1. Print
2. Save as XLSX to a USB
3. Save as CSV to a USB

The macro works great by either pressing the shortcut key defined for the macro, or by selecting View > Macros > View Macros > Run.

I have tried to create a button on the screen to run this macro - Developer > Insert > Button (under form controls). Then when prompted, select the macro that I have already created.

Then when I try run this macro via the button, it always fails with the following error
 macro error1
If I click Debug, I see the following:
 Macro Error 2
Not sure why this would only happen when attaching the Macro to a button. It's running the same command.
0
Comment
Question by:Mayogroup
5 Comments
 
LVL 41

Accepted Solution

by:
dlmille earned 250 total points
ID: 36714966
Can you just ensure one sheet is selected, then test from your control sequence/or developer's menu?  Then, assuming that works of course, try it from your button?

Do you get the same error?

Dave
0
 
LVL 41

Assisted Solution

by:dlmille
dlmille earned 250 total points
ID: 36714970
Also, do you have any dialog boxes or userforms up when you run this macro?  There is a known bug with this error, if that is the case.

Dave
0
 
LVL 1

Assisted Solution

by:VictorBraga
VictorBraga earned 125 total points
ID: 36716363
I believe this is not the case, but IgnorePrintAreas gave me an error while trying to reproduce this on Excel 2003.

You could remove this option and see if it works. By default, Excel doesn't ignore print areas.
0
 

Author Comment

by:Mayogroup
ID: 36716420
Also forgot to mention, this is in Excel 2010.
0
 
LVL 31

Assisted Solution

by:Rob Henson
Rob Henson earned 125 total points
ID: 36816680
Have you tried drawing a Basic Shape button and assigning the macro to that instead?

I am wondering if by using a FormControl button, the system is thinking that there is a Form open and therefore doing as Dave mentioned earlier with the 'known bug'.

Thanks
Rob H
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
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;…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

747 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

8 Experts available now in Live!

Get 1:1 Help Now