+ Reply to Thread
Results 1 to 5 of 5

Disabled print toolbar and menu but Print Macro button cannot print also...

  1. #1
    Registered User
    Join Date
    09-18-2014
    Location
    Malaysia
    MS-Off Ver
    2003
    Posts
    5

    Lightbulb Disabled print toolbar and menu but Print Macro button cannot print also...

    Hi,

    I'm trying to make everybody print from my Print micro button where it's also able to show print dialog box. But when I test to print it cannot print and the same message box appear as my disabled print menu message appear.

    Please help me.

    This is my code in ThisWorkbook:

    Private Sub Workbook_Open()

    With Sheet2

    .Protect Password:="160599", UserInterfaceOnly:=True

    .EnableOutlining = True

    End With
    End Sub
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    If ActiveSheet.Name = "Sheet3" Then Cancel = True
    End Sub

    This is my code in my Sheet 3 where my print command button situated:

    Private Sub CommandButton1_Click()
    If Application.Dialogs(xlDialogPrinterSetup).Show = True Then
    ActiveWindow.SelectedSheets.PrintOut
    End If
    End Sub

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Disabled print toolbar and menu but Print Macro button cannot print also...

    you need to use a global variable.

    And check that variable's status in the beforeprint macro.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-18-2014
    Location
    Malaysia
    MS-Off Ver
    2003
    Posts
    5

    Re: Disabled print toolbar and menu but Print Macro button cannot print also...

    Thank you for reply mehmetcik,

    Just want to confirm with you before try your code, doesn't it will effect to all other excel file if I use global variable?

    I try to disable the print menu for a workbook only. and for a new or other workbook the print menu should be enable.

    Thank you for your kind response.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Disabled print toolbar and menu but Print Macro button cannot print also...

    A global variable is simply usable by all macros in your book, and will keep its value when you exit subs or functions. It is still limited to the workbook it is defined in.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  5. #5
    Registered User
    Join Date
    09-18-2014
    Location
    Malaysia
    MS-Off Ver
    2003
    Posts
    5

    Re: Disabled print toolbar and menu but Print Macro button cannot print also...

    Thank you for your response Arkadi,

    I will try asap. and notify when resolve.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Set print area of selected range then print preview if ok then print the document!
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2014, 07:10 AM
  2. Disable Print button in Full Print Preview
    By RaquelAR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-17-2013, 02:03 PM
  3. [SOLVED] Print only current page! Not all 47 pages when print button is pressed?
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-11-2013, 10:06 AM
  4. VBA to set print range, open box asking for print qty, print, then redefine print area
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 06:43 PM
  5. Print Button to print UserForm for multi-sheet
    By smartcard in forum Excel General
    Replies: 12
    Last Post: 04-29-2010, 07:47 AM

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