We help IT Professionals succeed at work.
Get Started

Hidden rows showing up in my email attachment

kmgingee
kmgingee asked
on
2,912 Views
Last Modified: 2012-05-08
Hi Everyone:

Sorry if this is a really stupid question,but here goes:

I want to send a worksheet in the body of the mail,in the worksheet I have hidden cells:I unhide them but they still show up in the body of the email I send,Can some please show me how I unhide them in my macro? my code is pretty simple:


Sub Send_Range()

   ActiveWorkbook.EnvelopeVisible = True
   ' Set the optional introduction field thats adds
   ' some header text to the email body. It also sets
   ' the To and Subject lines. Finally the message
   ' is sent.
   With ActiveSheet.MailEnvelope
      .Introduction = "This is a sample worksheet."
      .Item.To = "E-Mail_Address_Here"
      .Item.Subject = "My subject"
      .Item.Send
   End With
End Sub


if it helps any: my hidden cells are from column F : column H,but i want the values in column I to be displayed.


if this is not doable my other (much disliked) option is have the the activesheet saved on the desktop and then the user sends it as an attachment.i really really dont want to do this

Sub MailSheet()
    Dim shtName As String
    shtName = ActiveSheet.Name
    ActiveSheet.Copy
    ActiveWorkbook.SaveAs FileName:=Application.GetSaveAsFilename("Copy of " & shtName, "Microsoft Excel File, *.xls")
    Application.DisplayAlerts = False
    Application.Dialogs(xlDialogSendMail).Show
    With ActiveWorkbook
        .ChangeFileAccess xlReadOnly
        Kill .FullName
        .Close False
    End With

    Application.DisplayAlerts = True
End Sub


so my request is either:

1)i am able to remove the hidden cells from the email body OR
2)send the activesheet as an attachment without saving on the users PC

Can someone please guide me?

Regards

Arun






Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2008
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE