Consulting

Results 1 to 9 of 9

Thread: Command Button to save, print and clear

  1. #1

    Command Button to save, print and clear

    I have a form users fill out to get what they need from our production dpeartment. The problem is, most don't save their orders after printing them, then they re-use an old order and type in new data while not changin everything on the form.

    I already have a command button to save to the main server using this code:
    [vba]Private Sub CommandButton1_Click()
    ActiveSheet.SaveAs Filename:= _
    "S:\Traffic\Prod Orders\" & Sheets("Sheet1").Range("B8") & " - " & Format(Now, "mm-dd-yy hh.mm AM/PM") & ".xls"
    End Sub[/vba]
    What can I add to print, then clear the contents (including buttons & checkboxes), and finally bring a clear worksheet?

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Post the workbook......
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Here it is. Not pretty.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    What if we just used the blank copy as a template....have it hidden. Create a new each time....they fill it out and hit the button and the copy is made per your button code and the active copy of the template is deleted?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I personally think a better idea is to keep a copy of each order in the same workbook instead of creating a bunch of excel files, one for each order....

    run this a couple of times to get an idea of what I am getting at......let me know if we are way off base for your needs.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    Quote Originally Posted by lucas
    I personally think a better idea is to keep a copy of each order in the same workbook instead of creating a bunch of excel files, one for each order....

    run this a couple of times to get an idea of what I am getting at......let me know if we are way off base for your needs.
    Apologies for not answering. I got called off this and onto some other pressing projects.

    If we were in a single location, I think the template idea would work fine. But we're spread out with five different sales teams in 4 different locations. Also, the end user has the mental agility of a small soap dish. So I'm trying to make it as dummy proof as I can. I have been using this at our location and with the exception of being able to clear the form, it works well. Any other thoughts would be appreciated.

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    A few thoughts.

    How about clearing it all down on opening, that way it is always fresh? Harsh but might work.

    I am with Steve though. Hold a template in the workbook. Start with a copy of that template, the user can fill it in. When they print it, save the workbook, hide that production form, and make a new one from the template (it will de facto be initialised).
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    Quote Originally Posted by xld
    A few thoughts.

    How about clearing it all down on opening, that way it is always fresh? Harsh but might work.

    I am with Steve though. Hold a template in the workbook. Start with a copy of that template, the user can fill it in. When they print it, save the workbook, hide that production form, and make a new one from the template (it will de facto be initialised).
    I guess I'm not getting it. Thank you for your time, I do appreciate it.

  9. #9
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I don't know what happened to my attachment but it doesn't matter I guess since you don't wish to use a template.

    The alternatives are, as Bob has suggested, you can clear all of the data on the sheet on open or on each use but you would have to address all of the controls on the sheet and the ranges and it would work but it would take some time to set up.

    Another alternative would be to use a userform to imput the data. That way each time you run the form you could have completely new data but that would require some work on the design of the sheet to print also.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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