HI I have below code which give me little problems. When there is a value in cell D10. a messagebox pop up and ask me to save the invoice , before i can close the workbook. It works ok. If there is no value it close right away. If there is a value it save the worksheet, but dont close the workbook. So basically its works.
I would like that if there is value in cell D10, dont save the worksheet, but dont close the workbook off course..But only save, when i have saved the invoice, as it ask me to do.
Its more that when there will be many invoices, it will take un nesssary time. I am sure it is maybe only a little thing. But i have played around and cant make it work.
And off course the hold idea is that it save without promt the user.
Please have a look at the code.
Sincerely
Abjac
Ps. Have crossposted this in below link, but sofar no answers, which solve my problem.
Minor error gives problem in code in Workbook_BeforeClose event
I would like that if there is value in cell D10, dont save the worksheet, but dont close the workbook off course..But only save, when i have saved the invoice, as it ask me to do.
Its more that when there will be many invoices, it will take un nesssary time. I am sure it is maybe only a little thing. But i have played around and cant make it work.
And off course the hold idea is that it save without promt the user.
Please have a look at the code.
Sincerely
Abjac
Ps. Have crossposted this in below link, but sofar no answers, which solve my problem.
Minor error gives problem in code in Workbook_BeforeClose event
Code:
<DIR>[SIZE=2]Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Masterinvoice").Activate
If Range("D10").Value > 0 Then
MsgBox ("You Have to save the invoice, before you can close the workbook")
Cancel = True
End If
Call setpass
Call TwoSheetsAndYourOut
Sheets("Masterinvoice").Activate
'Save changes to workbook when closing, without prompting user.
Me.Save
End Sub
</DIR>[/SIZE]