Solved

Access VBA - SendObject - change name of report being sent

Posted on 2010-08-23
3
659 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

740 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