K
kartune85
You can't call this function as a procedure because it comes back wit
'argument not optional'.
I've managed to place it in module1, I'm deleting the code above i
using:
Sub DeleteMostCode()
Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim HowManyLines As Long
Set VBCodeMod
ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
With VBCodeMod
StartLine = 1
HowManyLines = .CountOfLines - 61
.DeleteLines StartLine, HowManyLines
End With
End Sub
And I've got the procedure positioned at the bottom of the code and i
as follows:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
Call CopyData1
MsgBox "Data copied, now click OK to save and close"
Application.EnableEvents = False
ThisWorkbook.Save
Cancel = True
End Sub
It doesn't want to execute, otherwise I would see the MsgBox. When
click the close button on the workbook that SHOULD tell the procedur
to run but it just shows the alert: "Do you want to save?"
After I get this sorted out, the forms pretty much finished. I woul
appreciate any help I can get.
Kartune8
'argument not optional'.
I've managed to place it in module1, I'm deleting the code above i
using:
Sub DeleteMostCode()
Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim HowManyLines As Long
Set VBCodeMod
ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
With VBCodeMod
StartLine = 1
HowManyLines = .CountOfLines - 61
.DeleteLines StartLine, HowManyLines
End With
End Sub
And I've got the procedure positioned at the bottom of the code and i
as follows:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
Call CopyData1
MsgBox "Data copied, now click OK to save and close"
Application.EnableEvents = False
ThisWorkbook.Save
Cancel = True
End Sub
It doesn't want to execute, otherwise I would see the MsgBox. When
click the close button on the workbook that SHOULD tell the procedur
to run but it just shows the alert: "Do you want to save?"
After I get this sorted out, the forms pretty much finished. I woul
appreciate any help I can get.
Kartune8