Access Ribbon Export Group

  • Thread starter Thread starter Jonathan
  • Start date Start date
J

Jonathan

Hi,

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?

Thanks,
 
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:

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

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