utterly confused
New Member
- Joined
- Nov 23, 2005
- Messages
- 28
Have put a few messages on re this now but still need some help to get it running right.....I have the following in an invoice template...
Private Sub Workbook_Open()
Sheets("Sheet1").Select
Sheets("Sheet1").Unprotect
Sheets("Sheet1").Range("H13").Value = Sheets("Sheet1").Range("H13").Value + 1
Sheets("Sheet1").Protect
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim fpath As String, fName As String
fpath = "P:\K.B\GB Galvanising orders\"
fName = Sheets("Sheet1").[B13].Value & " - " & _
Sheets("Sheet1").[H14].Text & " - " & _
Sheets("Sheet1").[H13].Value & ".xls"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=fpath & fName
Application.DisplayAlerts = True
End Sub
The only problem is that the numbering will not count on one from the template. Only counts on if I go in and open the last invoice done and saved which I don't want to do. Want all users to be able to open the invoice from a shortcut on their screen and fill it out. Can anyone help I am sure it is only something simple.
Also is there anything I can add to have this print automatically upon closing?
Please help have been working on this for days and days. Thanks in advance!!!!
Private Sub Workbook_Open()
Sheets("Sheet1").Select
Sheets("Sheet1").Unprotect
Sheets("Sheet1").Range("H13").Value = Sheets("Sheet1").Range("H13").Value + 1
Sheets("Sheet1").Protect
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim fpath As String, fName As String
fpath = "P:\K.B\GB Galvanising orders\"
fName = Sheets("Sheet1").[B13].Value & " - " & _
Sheets("Sheet1").[H14].Text & " - " & _
Sheets("Sheet1").[H13].Value & ".xls"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=fpath & fName
Application.DisplayAlerts = True
End Sub
The only problem is that the numbering will not count on one from the template. Only counts on if I go in and open the last invoice done and saved which I don't want to do. Want all users to be able to open the invoice from a shortcut on their screen and fill it out. Can anyone help I am sure it is only something simple.
Also is there anything I can add to have this print automatically upon closing?
Please help have been working on this for days and days. Thanks in advance!!!!