Solved

Access VBA - SendObject - change name of report being sent

Posted on 2010-08-23
3
665 Views
Last Modified: 2012-08-14
Hi

I want to change the name of the report being sent using the following VBA code:
 DoCmd.SendObject acSendReport, "MyReport", acFormatPDF, oEmailAddress, , , oSubject, oBody

I need "MyReport" to change to another name when attached eg "Report Week 1"
0
Comment
Question by:murbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:fabriciofonseca
ID: 33505154
Actually this is the piece of the code where you put the name of the report you are exporting.

If you want to change it, just write there the name of any other report you want to export.


Is it part of a bigger code? The question does not make much sense the way it is now. Could you support us with more details?
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 33506218
You can't really automate this in the manner you wish. You can use other code to "print" the report to a file (like a PDF, for example), then use automation to use Outlook (or some other client) to send the email. Since you didn't mention what version of Access you're using it's hard to advise further.

Access 2007 includes an addin that can be used to print a file to PDF.

Access 2003 or earlier needs additional handling (see the Lebans PrintToPDF utility: www.lebans.com)
0
 

Author Closing Comment

by:murbro
ID: 33525466
Thanks
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question