View Single Post
  #1   Report Post  
FSt1
 
Posts: n/a
Default

hi nigel,
here is some code i wrote a while back for someone needing to do about what
your are doing only with Purchase Orders (POs). It should work for invoices
also.
i'm not sure if i understand the need for step 1. you say you can do step 2.
this will do step 3.
it will require some editing to make it fit your template. there are
explainations. just change the term PO for invoice.

Sub MacCreatePO()

'Written by FSt1 on 3/14/05.

'Creates a new PO(purchase order) workbook, saving the created PO workbook
with
'the PO number as part of the file name. Leaves the "template" PO workbook
"as is".
'macCreatePO should be triggered from a button on the PO Template sheet.

Dim n As Range
Set n = Range("A1") ' the all important PO number.
'Edit PO number address to the place on your PO
template.
Application.CutCopyMode = False 'clears the clipboard
Range("A1:L25").Select 'edit to accommodate the size of your PO template
Selection.Copy
Workbooks.Add
Range("A1").PasteSpecial xlPasteAll
'Edit the file path to where you want to save the PO workbook on your PC
or
'network
ActiveWorkbook.SaveAs Filename:="H:\CodeStuff\PO" & n & ".xls",
FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWorkbook.Close
Cells(1, 1).Select 'go and park at cell A1 and wait
MsgBox ("Purchase Order was saved as PO" & n & ".xls")
n.Value = n.Value + 1 'add 1 to old PO number for new PO number
'change the place of the date to add. Macro puts today's date in but
'this can be edited.
Range("I1") = Date
'clear the contents of the old PO to set up the next PO. clear
surgically so to leave
'template in tact. more clearContents commands may be needed.
'remember...this is a surgical delete. only the data and not the
template.
'the line below should be edited to fit your data.

Range("C5,C6,C8,C9,C10,E5,E6,E8,E9,E10,G5,G7,G8,G9 ,G10,F12,D13,G13").ClearContents
ActiveWorkbook.Save 'save the cleared template workbook with new(next)
PO number.
'Ready for next PO
End Sub
regards
FSt1

"Nigel" wrote:

Hi,
is there a code or can someone point me in the right direction? i have a
workbook with invoices and i need it to do the following:
1. press a button and it will copy a template and place it at the end of all
other sheets naming it in invoice numerical order ( 1234,1235,1236 etc)
2. create a link to a front page to transfer basic information ( i can do
this )
3. export the active sheet to be an independent sheet on its own in a
specific location like ( s:\invoicing\yearly invoices\month )
i have a folder in this location with sub folders ranging from April to
September 06

I am ok with code and underatand it however i just cannot seem to work out
how to do this.


help appreciated

N.S.