+ Reply to Thread
Results 1 to 4 of 4

Printing worksheets of an add-in (.xlam)

  1. #1
    Registered User
    Join Date
    04-29-2011
    Location
    Europe
    MS-Off Ver
    Excel 2007
    Posts
    22

    Printing worksheets of an add-in (.xlam)

    Hello,

    I'm currently working on an add-in for Excel, which should include the option to generate and print a report. I use the following code for this:

    Please Login or Register  to view this content.
    Unfortunately, this only works in a normal workbook (.xlsm), but not in an add-in (.xlam), where I get a run-time error (1004). This is presumably due to the fact that worksheets in an add-in are always hidden. Point in case: I get the same error in a normal workbook when I hide the worksheet before trying to print it.

    Is there a way around this problem?

    Thank you in advance!

    nymm
    Last edited by nymm; 02-15-2012 at 09:41 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Printing worksheets of an add-in (.xlam)

    I think you will need to change the Isaddin Property to False, run the code thhen reset it to True, hide all this by switching off screen updating
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Printing worksheets of an add-in (.xlam)

    I wouldn't modify the add-in but rather create a new workbook and work with that.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  4. #4
    Registered User
    Join Date
    04-29-2011
    Location
    Europe
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Printing worksheets of an add-in (.xlam)

    Thank you both for the swift reply! Both solutions work, so I'll do some further testing to see which option gives me the best results.

    Kind regards

    nymm

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1