something just not right in code, please help!

S

Sherry

I'm trying to save the workbook to the location it was opened from, update
it, upon closing it it will change the name acording that what is in cells a1
and a2 and then e-mail it to the specified address. Pleae take a look and
let help with the correct coding.

Sub Mail_Workbook_2()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim wbname As String
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
wbname = " " & " " & MTR & " " _
Range ("a1") & ("a2) & ".xls"
wb1.SaveCopyAs wbname
Set wb2 = Workbooks.Open(wbname)
With wb2
..SendMail "(e-mail address removed)", _
"MTR"
..Close False
End With
Application.ScreenUpdating = True
End Sub
 
N

Norman Jones

Hi Sherry,

Try:

'=============>>
Public Sub Mail_Workbook_2()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim wbname As String

Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
wbname = "MTR " & Range("A1").Value _
& Range("A2").Value & ".xls"
wb1.SaveCopyAs wbname
Set wb2 = Workbooks.Open(wbname)
With wb2
.SendMail "(e-mail address removed)", "MTR"
.Close Savechanges:=False
End With
Application.ScreenUpdating = True
End Sub
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top