ioncila
12-22-2009, 05:25 AM
Hi
I've already learnt how to export a sheet to a new workbook and email it.
But What I wish to do is to export only the first 25 rows.
What changes do I need to do in the code below?
Private Sub CommandButton4_Click()
msg = "Do you wish to create a new workbook?"
If MsgBox(msg, vbQuestion + vbYesNo, "ATTENTION") = vbNo Then
Exit Sub
End If
Dim sFile As String
Dim avLink As Variant
Dim vLink As Variant
Dim strDate As String
strDate = Format(Date, "dd mmmm yyyy") & " " & Format(Time, "hh:mm:ss")
Worksheets(Array("MONTH RESUME")).Copy
With ActiveWorkbook
sFile = Application.GetSaveAsFilename( _
FileFilter:="Excel Files (*.xls), *.xls", _
Title:="Specify Location for Copy:")
If sFile <> "False" Then
avLink = .LinkSources(xlExcelLinks)
For Each vLink In avLink
.BreakLink Name:=vLink, Type:=xlLinkTypeExcelLinks
Next vLink
.SaveAs Filename:=sFile
End If
.SendMail "abcde@gmail.com", _
"MONTH REPORT" & " " & strDate
.Close SaveChanges:=False
End With
End Sub
Thanks
I've already learnt how to export a sheet to a new workbook and email it.
But What I wish to do is to export only the first 25 rows.
What changes do I need to do in the code below?
Private Sub CommandButton4_Click()
msg = "Do you wish to create a new workbook?"
If MsgBox(msg, vbQuestion + vbYesNo, "ATTENTION") = vbNo Then
Exit Sub
End If
Dim sFile As String
Dim avLink As Variant
Dim vLink As Variant
Dim strDate As String
strDate = Format(Date, "dd mmmm yyyy") & " " & Format(Time, "hh:mm:ss")
Worksheets(Array("MONTH RESUME")).Copy
With ActiveWorkbook
sFile = Application.GetSaveAsFilename( _
FileFilter:="Excel Files (*.xls), *.xls", _
Title:="Specify Location for Copy:")
If sFile <> "False" Then
avLink = .LinkSources(xlExcelLinks)
For Each vLink In avLink
.BreakLink Name:=vLink, Type:=xlLinkTypeExcelLinks
Next vLink
.SaveAs Filename:=sFile
End If
.SendMail "abcde@gmail.com", _
"MONTH REPORT" & " " & strDate
.Close SaveChanges:=False
End With
End Sub
Thanks