Change backgroung before print

Important Notice


Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • Can anyone help change colors in the following code:



    I tried to use some excel vba I know, but they are obviously not as interchangeable as I would wish.

    [SIZE=2]I should change my name to STUMBED![/SIZE]

  • Re: Change backgroung before print


    From this it is hard to get a feel for what you are trying to do. You will need to refer to the object by name very specifically such as:


    Code
    Forms("UPDATE").Controls("Label2").forecolor = vbBlue

    :guitar: - Scott

  • Re: Change backgroung before print


    So that is a great start, I have edited the line to

    Code
    Forms("Refunds sorted by Property Name").Controls("section:Detail").ForeColor = vbWhite


    I need to change the "Back Color" of the whole form. O am assuming that I would just change ForeColor to BackColor but I still cant seem to find how to call the form to be changed. I tried "Section" and "Detail" individually but cant seem to get it.

    [SIZE=2]I should change my name to STUMBED![/SIZE]

  • Re: Change backgroung before print


    Ah the form itself, syntax is such a crazy thing...


    Try this:


    Code
    Forms("Refunds sorted by Property Name").Section(acDetail).BackColor = vbWhite
    
    
    'or shorter version if the code is in the form itself
    
    
    Me.Section(acDetail).BackColor = vbWhite

    :guitar: - Scott

  • Re: Change backgroung before print


    So where can I find a list of all the colors that can be used.
    I want to change it back to the default light brown color after the print.


    I know the number is -2147483633

    [SIZE=2]I should change my name to STUMBED![/SIZE]

  • Re: Change backgroung before print


    So I figured it out, thanks for all your help Scott.


    I tried to put the number I wanted in place of the name and that didnt work earlier :? . The number of course does work. The problem was the place of my last line.


    I wanted to
    Change > Print > Change
    I was actually
    Change > Print > Close > Change
    which it was of course to late to change back.
    So here is the final code using both sort and long versions you gave me. :thanx:

    [SIZE=2]I should change my name to STUMBED![/SIZE]

  • Re: Change backgroung before print


    Why not store the existing color in a variable?

    Boo!:yikes:

  • Re: Change backgroung before print


    I could but I dont what the difference would really be. It still would have to go through all the same processes and the color of the form isnt going to change.

    [SIZE=2]I should change my name to STUMBED![/SIZE]

  • Re: Change backgroung before print


    WOW! I havent been on in awhile, I see you went over the 6K mark. I know I have greatly benefited from your help.

    [SIZE=2]I should change my name to STUMBED![/SIZE]

  • Re: Change backgroung before print


    Chris


    What if you decide you want to change the colour at a later date?


    If you store the colour then you don't need it hard-coded.

    Boo!:yikes:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!