+ Reply to Thread
Results 1 to 9 of 9

Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

  1. #1
    Registered User
    Join Date
    11-03-2022
    Location
    London, England
    MS-Off Ver
    Office 2021
    Posts
    11

    Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    Hello,
    I see these codes in my book:
    Please Login or Register  to view this content.
    but I am questioned about two things:
    1. Why add Cancel As Boolean on the first row?
    2. Why add EntireColumn before Hidden
    It didn't use Cancel at all and Range("B:D") are three columns exactly.
    Thanks.

  2. #2
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    1. Its part of the event. You can cancel ongoing print procedures for example.
    2. Try columns("B:D").Hidden = true
    Last edited by JEC.; 11-20-2022 at 07:52 AM.

  3. #3
    Registered User
    Join Date
    11-03-2022
    Location
    London, England
    MS-Off Ver
    Office 2021
    Posts
    11

    Re: Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    I still don't understand.
    1. How can I cancel it? I tested it and didn't find any button of Cancel.
    2. What is the difference between columns("B:D") and Range("B:D")?

  4. #4
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    1. See this page for more info
    https://learn.microsoft.com/en-us/of...ok.beforeprint

    2. Using columns(..), you already refer to the columns. If you use Range(..), you need to call entirecolumn before you can refer to the column. But, I see your confusion.

  5. #5
    Registered User
    Join Date
    11-03-2022
    Location
    London, England
    MS-Off Ver
    Office 2021
    Posts
    11

    Re: Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    Thanks. But didn't Range("B:D") refers to columns("B:D")? If it didn't, what else did it refers to?

  6. #6
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    Yes it does, but you can not just use .hidden after Range(..)

  7. #7
    Registered User
    Join Date
    11-03-2022
    Location
    London, England
    MS-Off Ver
    Office 2021
    Posts
    11

    Re: Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    But I see the 'Hidden' is one of the members of 'Range'. Why can't I use it after Range(..)?

  8. #8
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    Because you can’t hide a range.
    Just the entire rows or columns of that range

  9. #9
    Registered User
    Join Date
    11-03-2022
    Location
    London, England
    MS-Off Ver
    Office 2021
    Posts
    11

    Re: Why add Cancel As Boolean and EntireColumn when hide some columns before printing?

    But why 'Hidden' is one of the members of 'Range'?Attachment 805814

+ 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. Workbook_open_beforeprint(cancel as boolean) problem
    By daboho in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-14-2017, 02:21 PM
  2. [SOLVED] Exit Workbook_BeforeClose(Cancel As Boolean) if a public boolean = true
    By meabrams in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2016, 06:10 AM
  3. Cancel as Boolean argument
    By Larry.LeBlanc@O in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2015, 01:29 PM
  4. [SOLVED] Cancel As Boolean Help
    By Kiotofl in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-25-2014, 11:26 AM
  5. Workbook_BeforeClose(cancel As Boolean)
    By Vdogeek in forum Excel General
    Replies: 3
    Last Post: 05-23-2014, 12:39 PM
  6. Private Sub Workbook_BeforePrint(Cancel As Boolean) not executing procedures
    By Burrswood in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2013, 11:48 AM
  7. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) problem
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2009, 07:28 PM

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