close

I have a large report in excel and I'd like to pull out a couple of pages to
send as an attachment. Can't find how to do this. Can someone help? Thanks:-)

You might want to try the Edit menu | Move or Copy sheet option, copying the
intended worksheets to another workbook, then send THAT workbook as an
attachment.

If you want only part of a worksheet, use copy and paste into a new workbook
and send that.quot;bellamerequot; wrote:

gt; I have a large report in excel and I'd like to pull out a couple of pages to
gt; send as an attachment. Can't find how to do this. Can someone help? Thanks:-)

Hi bellamere

Try this tester that will copy page 4 to a new sheet
No error check to see if page 4 exist in this example

You can send this sheet with code or with my Add-in
www.rondebruin.nl/sendmail.htmSub Test_HPageBreak()
Dim HPB As HPageBreak
Dim RW As Long
Dim PageNum As Long
Dim WB As Workbook
Dim Asheet As Worksheet
Dim Nsheet As Worksheet
Dim Acell As Range

Set Asheet = ActiveSheet
If Asheet.HPageBreaks.Count = 0 Then
MsgBox quot;There are no HPageBreaksquot;
Exit Sub
End If
Application.ScreenUpdating = False
Set WB = ActiveWorkbook
'Because of this bug we select a cell below your data
'support.microsoft.com/default.aspx?scid=kb;en-us;210663
Set Acell = ActiveCell
Application.Goto Range(quot;Aquot; amp; Rows.Count), True
RW = 1
PageNum = 1
For Each HPB In Asheet.HPageBreaks
If PageNum = 4 Then
Set Nsheet = Worksheets.Add(after:=WB.Sheets(WB.Sheets.Count))
On Error Resume Next
Nsheet.Name = quot;Page quot; amp; PageNum
If Err.Number gt; 0 Then
MsgBox quot;Change the name of : quot; amp; Nsheet.Name amp; quot; manuallyquot;
Err.Clear
End If
On Error GoTo 0
With Asheet
.Range(.Cells(RW, quot;Aquot;), .Cells(HPB.Location.Row - 1, quot;Kquot;)).Copy _
Nsheet.Cells(1)
End With
' If you want to make values of your formulas use this line also
' Nsheet.UsedRange.Value = Nsheet.UsedRange.Value
End If

RW = HPB.Location.Row
PageNum = PageNum 1
Next HPB
Asheet.Select
Asheet.DisplayPageBreaks = False
Application.Goto Acell, True
Application.ScreenUpdating = True
End Sub

--
Regards Ron de Bruin
www.rondebruin.nlquot;bellamerequot; gt; wrote in message ...
gt;I have a large report in excel and I'd like to pull out a couple of pages to
gt; send as an attachment. Can't find how to do this. Can someone help? Thanks:-)

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()