![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 7
|
Hi,
I'm trying to create an invoice with a button in so that the user can click the button when all data is entered to save to a file (it needs to pick up the invoice number automatically from the form) and print a copy off. Any ideas? I've seen it done before, but i havent got a clue how to do it??? Cheers Gav |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
You want to save the invoice as a seperate file with the file name being the invoice number and then print out the invoice? Do you need data validation before allowing the save and print? Thanks, Tom |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Posts: 7
|
Yes, I want to save the invoice as a seperate file with the file name being the invoice number and then print out the invoice.
Theres no need for the data to be validated first though - only a fairly simple invoice (for now) |
|
|
|
|
|
#4 | |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Quote:
|
|
|
|
|
|
|
#5 |
|
New Member
Join Date: Apr 2002
Posts: 7
|
Cheers mate - that works great.
Next question - How can i get the form to generate a new invoice number every time ie - last invoive was 1001 so next will automatically be saved as 1002??? Is this possible or is there another way to do something similar? |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
If the invoice will be saved every time, just add this line of code to the above procedure directly above this line: InvoiceNumber = Range("A1") One again, replace A1 with the actual cell with the invoice number... Range("A1") = Range("A1") + 1 InvoiceNumber = Range("A1") Tom |
|
|
|
|
|
#7 |
|
New Member
Join Date: Apr 2002
Posts: 7
|
Cheers again...
What about when he runs the macro, it will automatically insert the date and time into the form and save it as eg 1001_22-04-02.xls ?? PS - forgive my questions, i'm new to the vb scene. I've had "vb for dummies" for about 4 months now and still haven't touched it - i find it easier to learn like this!! Cheers Gav |
|
|
|
|
|
#8 | ||
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
I'm not sure exactly what you are needing?
Is 1001_22-04-02 the invoice number? Or Invoice number plus date for just saving as the filename? If all you are needing is to collate the invoice number and date to save the file then replace the following two lines: Quote:
Quote:
Of course, you do not need the message box... Is this what you are after? Tom |
||
|
|
|
|
|
#9 |
|
New Member
Join Date: Apr 2002
Posts: 7
|
Fantastic. All works a treat
Nearly finished... All i need to do now is to insert the date into the form itself so that it updates itself, and to place a button on the form that actions the macro. Gav |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|