Consulting

Results 1 to 8 of 8

Thread: Solved: make all backcolor white before print

  1. #1
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location

    Solved: make all backcolor white before print

    Is there a way to make all Back color of userform white. I have this code

    [VBA]'--------------------Shipped By Name Enter----------------------------
    Private Sub TxtShippedBy_Enter()
    Me.TxtShippedBy.BackColor = RGB(0, 200, 200)
    End Sub
    '--------------------Shipped By Name Exit----------------------------
    Private Sub TxtShippedBy_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Me.TxtShippedBy.BackColor = RGB(255, 255, 255)
    End Sub[/VBA]

    This works great it makes the backcolor of the active txtbox or cmbbox lite blue. But When I print what ever box was selected stays with the lite blue color and prints like that. Any Ideas?

  2. #2
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    How are you printing the userform? Are you using "Me.PrintForm"?




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  3. #3
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Yeah basically I just have another form that is my printform which has [VBA]Userform1.printform[/VBA] on it.

  4. #4
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Ok. Then you could try to switch the color anyway you want it right before you say "Userform1.PrintForm", and then just change it back to what it was after that line of code.

    Or is there more to it that I just don't see?




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  5. #5
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    Yeah. Is there a way to say Active Tab Change Backcolor? Because there are over 30 txtboxes and over 18 Cmbboxes and my color code appears on entering one of them and then changes to white when exiting, but if they click the save/Print button and one of the txtboxes are highlighted in the color it prints out.

  6. #6
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    I don't see why that would happen, though. Once you click the button to print/save, the Exit event of the active textbox would occur before the code in the button would activate...well, that's what I understand should happen.

    From the Help:
    Exit occurs immediately before a control loses the focus to another control on the same form.
    Maybe you could try UserForm1.Repaint before you try to print...???

    If that doesn't work, could you possibly show us some more code?




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  7. #7
    VBAX Expert
    Joined
    Apr 2007
    Location
    Orlando, FL
    Posts
    751
    Location
    ok what i did was I setfocus a value before print and made the backcolor white. Then after print setfocus and changed it back to blue.

  8. #8
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    I'm still surprised at how the textbox control still had the focus even after you clicked a button. Unless you didn't click a button, but use a keyboard combo?

    Either way, glad you have resolved it




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

Posting Permissions

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