Hi all !
I have the following code but would like to close the workbook at the end :
Part 1 Unhides 2 rows
Part 2 Saves the workbook as cell B1
Part 3 Emails the new saved workbook as attachment via Lotus Notes
This is when I need to close the workbook.
I have tried various combinations of Workbook Close but have no luck.
If anyone can help I would very much appreciate it.
(Before I chew off my own arm )
I have the following code but would like to close the workbook at the end :
Part 1 Unhides 2 rows
Part 2 Saves the workbook as cell B1
Part 3 Emails the new saved workbook as attachment via Lotus Notes
This is when I need to close the workbook.
I have tried various combinations of Workbook Close but have no luck.
If anyone can help I would very much appreciate it.
(Before I chew off my own arm )
Code:
Sub ClickToApproveProcess()
'Unhide Approvers Rows'
ActiveSheet.Rows("26").EntireRow.Hidden = False
ActiveSheet.Rows("28").EntireRow.Hidden = False
'end'
'SaveCopyAsSupplier'
ActiveWorkbook.SaveAs Sheets("NewSupplierRequest").Range("B1")
'Sub MailAttachAsCellName()'
Dim oSess As Object
Dim oDB As Object
Dim oDoc As Object
Dim oItem As Object
Dim direct As Object
Dim Var As Variant
Dim flag As Boolean
Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GetDatabase("", "")
Call oDB.OpenMail
flag = True
If Not (oDB.IsOpen) Then flag = oDB.Open("", "")
If Not flag Then
MsgBox "Can't open mail file: " & oDB.SERVER & " " & oDB.FILEPATH
GoTo exit_SendAttachment
End If
On Error GoTo err_handler
'Building Message
Set oDoc = oDB.CreateDocument
Set oItem = oDoc.CreateRichTextItem("BODY")
oDoc.Form = "Memo"
oDoc.Subject = "New Supplier ( " & Range("B1") & " ) requires your approval *v5"
oDoc.SendTo = "Stuartluckhurst@ebgbakeries.co.uk"
oDoc.Body = ""
oDoc.postdate = Date
oDoc.SaveMessageOnSend = True
'Attaching DATABASE
Call oItem.EmbedObject(1454, "", Range("H1") & ".xls")
oDoc.visable = True
'Sending Message
oDoc.Send False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing
'Done
Exit Sub
err_handler:
If Err.Number = 7225 Then
MsgBox "File doesn't exist"
Else
MsgBox Err.Number & " " & Err.Description
End If
On Error GoTo exit_SendAttachment
End Sub