I don't have download, but here is a custiom ribbon I make for reports
This ribbon was biult this way so it works in both the full version of
ms-access and also the runtime. So this will allow you to run your applicaon
on computers that don't have the full version of ms-access.
You don't really have to write any code here, but just cut + paste what I
have below...
First, create a standard code module callsed basApi (or whatever you like).
Paste in the code here:
http://www.mvps.org/access/api/api0001.htm
The above is just code to give us the file open dialog. You never have to
read, nor look at that code (so, it is messy and long..but I never looked at
it and we don't care about reading it). Save the above module.
Ok, Now, lets write some custom code that be run when you press a button on
the ribbon. Create antoher code module. Call it basReports, or whatever.
Simply paste in the follwing code:
Option Compare Database
Option Explicit
Public Function MySend()
DoCmd.SendObject acSendReport, Screen.ActiveReport.Name, acFormatPDF
End Function
Public Function MyExport(strFormat As String)
Dim strFileType As String
Dim strFileFilter As String
Dim strFileName As String
Select Case strFormat
Case "RTF" ' word
strFileType = acFormatRTF
strFileFilter = "*.rtf"
Case "XLS" ' excel
strFileType = acFormatXLS
strFileFilter = "*.XLS"
Case "TXT" ' text
strFileType = acFormatTXT
strFileFilter = "*.txt"
Case "HTML"
strFileType = acFormatHTML
strFileFilter = "*.html"
Case Else
Exit Function
End Select
strFileName = SaveFileName(strFileType, strFileType, strFileFilter)
If strFileName <> "" Then
DoCmd.OutputTo acOutputReport, Screen.ActiveReport.Name, strFileType,
strFileName
End If
End Function
Public Function SaveFileName(strTitle As String, _
strFilterText As String, _
strFilter As String) As String
strFilter = ahtAddFilterItem(strFilter, strFilterText, strFilter)
SaveFileName = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
DialogTitle:=strTitle, _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
End Function
There is 3 routines in the above. One gives a send as "pdf" email option,
and the other routines are simply a file dialog browse, and a some code to
export the report as our desired format.
Last but not least, here is our custrom ribbon that you specify for all
reports
<customUI xmlns="
http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="MyReport" label="Report Print and View Options">
<group idMso="GroupPrintPreviewPrintAccess" />
<group idMso="GroupPageLayoutAccess" />
<group idMso="GroupZoom" />
<group id="ListCommands" label="Print">
<button idMso="FilePrintQuick" keytip="q" size="large"/>
<button idMso="PrintDialogAccess"
label="Print Dialog"
keytip="d" size="large"/>
</group>
<group id="ExportCmds" keytip="e" label="Data Export">
<button idMso="PublishToPdfOrEdoc" keytip="p" size="large"/>
<button id="ExportExcel" label="Excel"
imageMso="ExportExcel" size="large"
onAction="=MyExport('XLS')"/>
<button id="ExportWord" label="Word"
imageMso="ExportWord" size="large"
onAction="=MyExport('RTF')"/>
<button id="ExportTextFile" label="Text"
imageMso="ExportTextFile" size="large"
onAction="=MyExport('TXT')"/>
<button id="ExportHtml" label="HTML Document"
imageMso="ExportHtmlDocument" size="large"
onAction="=MyExport('TXT')"/>
<button id="CreateEmail" label="Email Report (PDF)"
imageMso="FileSendAsAttachment"
enabled="true" size="large"
onAction= "=MySend()"/>
</group>
<group idMso="GroupZoom"></group>
<group id="Exit" keytip="x" label="Exit">
<button idMso="PrintPreviewClose" keytip="c" size="large"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
That is it. So, you don't have to write any code...just cut + paste the
above....and you have a ribbon with the export icons, but you ALSO will have
a email as PDF icon on your ribbon.