+ Reply to Thread
Results 1 to 7 of 7

Create a macro to solve a hidden sheet as pdf

  1. #1
    Registered User
    Join Date
    10-14-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2011
    Posts
    17

    Unhappy Create a macro to solve a hidden sheet as pdf

    Hi,

    I am beginner beginner beginner...lol

    I would like to create a button that allows to save a hidden sheet as a pdf file using a name composed like MENU-(+Date specified in cell of the active sheet).

    So the main sheet is A_REMPLIR. Once the sheet is filled in the user pushes the button and the hidden sheet MENU_A3P_FR_NL is saved as a pdf with the name MENU_(date filled in active sheet A_REMPLIR in cell A10).

    Does all this makes sense??? lol

    A previous post helped me out with a macro that runs as follows :


    Please Login or Register  to view this content.
    The macro bugs once the sheets are hidden... ;-(

    Al the help i can get is welcome... ;-)

    W
    Last edited by sunny_island2002; 10-16-2012 at 02:13 PM. Reason: Added code tags

  2. #2
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Create a macro to solve a hidden sheet as pdf

    Be more specific with "the macro bugs". Do you get an error message? If so, what kind of message? Does the debugger pop up? If so, what row of code is highlighted?

    The more specific you can be, the better.

    The code runs fine for me.

    Your variable pname (which you don't use anywhere) contains a refernce to "Macintosh HD". Are you running Excel on a Mac? If so, are you running Office for Mac or are you running in Windows via a virtual machine?

  3. #3
    Registered User
    Join Date
    10-14-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2011
    Posts
    17

    Re: Create a macro to solve a hidden sheet as pdf

    g8r777, Thanks for your interest ... i am getting a runtime error '1004'

    When I debug i get the error on line : Sheets(nname).Visible = True... so i guess it is with the fact the sheets are hidden...

    W

  4. #4
    Registered User
    Join Date
    10-14-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2011
    Posts
    17

    Re: Create a macro to solve a hidden sheet as pdf

    I FOUND THE MISTAKE.... I think... it's because i protected the Workbook... when I unprotect the Workbook the script works...

    Thanks to all for the tips and moral support...lolololol

    W

  5. #5
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Create a macro to solve a hidden sheet as pdf

    Protecting the workbook was what was giving you the error.

    You can add code that unprotects your workbook. If you use a password for that and other users are going to be using the workbook as well, you should probably password protect you VBAProject or your users can open up the Visual Basic editor and see the code with password.

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Create a macro to solve a hidden sheet as pdf

    @ sunny_island2002

    Welcome to the forum.

    Please notice that [CODE] tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at the top of the page and read Rule #3.
    Thanks.

  7. #7
    Registered User
    Join Date
    08-15-2012
    Location
    Las Vegas
    MS-Off Ver
    Excel 2010
    Posts
    87

    Re: Create a macro to solve a hidden sheet as pdf

    I didn't have time earlier but here is the code to unlock the workbook, run the rest of your code and then lock the workbook again.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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