Access Ribbon Export Group




I created a customized Ribbon for use in Access Runtime. All of our users
use Runtime to do their work. When I created the Ribbon I added groups, like
the Clipboard group for copy and paste, the Font group for customizing
text, the Export group etc.

My problem is, the Export group that I added is not showing fully. The only
button available is the "PDF&XPS" button and the "More" button which is
disabled. In the full version I have additinal buttons to export to Word,
Excel etc. that are funtional. How do I make them available in Runtime?


Albert D. Kallal

When building runtime, you usually have to provide your own menu.

For the exports, the "parts" are available from code, you just have to make
a menu.

I don't have download, but here what to do:

create a standard code module callsed basApi (or whatever you like).

Paste in the code here:

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).

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,
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, _

End Function

There is 3 routines in he 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

<customUI xmlns="">
<ribbon startFromScratch="true">
<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 id="ExportCmds" keytip="e" label="Data Export">
<button idMso="PublishToPdfOrEdoc" keytip="p" size="large"/>

<button id="ExportExcel" label="Excel"
imageMso="ExportExcel" size="large"

<button id="ExportWord" label="Word"
imageMso="ExportWord" size="large"

<button id="ExportTextFile" label="Text"
imageMso="ExportTextFile" size="large"

<button id="ExportHtml" label="HTML Document"
imageMso="ExportHtmlDocument" size="large"

<button id="CreateEmail" label="Email Report (PDF)"
enabled="true" size="large"
onAction= "=MySend()"/>

<group idMso="GroupZoom"></group>

<group id="Exit" keytip="x" label="Exit">
<button idMso="PrintPreviewClose" keytip="c" size="large"/>


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...

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question