+ Reply to Thread
Results 1 to 2 of 2

Print and Print Preview don't match screen

  1. #1
    JNohl
    Guest

    Print and Print Preview don't match screen


    Hi All,
    I'm relatively new to VB programming in Excel and am having the
    following problem. I've got a sheet with a couple of frames on it. On
    each of the frames, I have a couple textboxes. The user inputs values
    into the textboxes and prints the form. I have a "clear" button that
    initializes the textboxes by moving "" to the .Value property.
    However, when I do a print preview or a print, the value has not
    changed. The only way to get the value to change on the print out is
    to click somewhere on the frame.

    I've tried setting focus to each textbox before I enter the value, but
    this seems to only correct the last textbox checked before the print
    command was issued. I've also tried to send a "click" to the frame
    from within the code, but this doesn't seem to do anything. You have
    to manually click on the frame from the screen to get it to update.
    I've also tried ThisWorkbook.RefreshAll, but again, nothing.

    Can anyone explain what is going on and how I need to correct this?
    Any assistance would certainly be appreciated.

    Thanks in Advance,
    John


    --
    JNohl

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good evening John

    I had a similar problem to this, with a userform not updating a checkbox's .Value and it certainly caused a lot of thought and head scratching. I actually posted a request on this site with no correct answers forthcoming, and try as I might I couldn't find anything in any of my reference books, or any of the various helpful Excel focused websites that exist - for such a seemingly simple problem.

    The answer lies in the event procedures - you need to put the code that clears the box (you're on the right lines to change the .Value to "") in the correct event procedure. Try putting the code in a procedure entitled

    Private Sub TextBox1_Change()

    which should trigger the update when the value has changed. If this particular one doesn't work try checking other events around the textbox procedure. Do post back to let me know how you go.

    HTH

    DominicB

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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