I converted application from 2003 to 2007.
I have one pivot tbl and I need to export to Excel.
I create new ribbon bar with Export to Excel Button working find but when
I convert mdb file to mde I am loosing (not visible) excel button group name is here excel button is not.
I start using difference techniques:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="MyPivotTable" label="Pivot Table">
<group id="GroupPivotTableDataAccess" keytip="p" label="Pivot Table Data Access">
<button id="PivotExportToExcel" label="Excel"
imageMso="PivotExportToExcel" size="large"
onAction="=MyExportPivotTbl('XLS')"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
onAction="=MyExportPivotTbl('XLS')" I call procedure from module
Public Function MyExportPivotTbl(strFormat As String)
Dim strFileType As String
Dim strFileFilter As String
Dim strFileName As String
strFileType = acFormatXLS
strFileFilter = "*.XLS"
strFileName = SaveFileName(strFileType, strFileType, strFileFilter)
If strFileName <> "" Then
DoCmd.OutputTo acOutputForm, Screen.ActiveForm.name, strFileType, strFileName
End If
End Function
Public Function SaveFileName(strTitle As String, _
strFilterText As String, _
strFilter As String) As String
Dim f As FileDialog
Dim strF As String
Dim strExt As String
Set f = Application.FileDialog(msoFileDialogSaveAs)
f.Title = strTitle
'f.Filters.Add strFilterText, strFilter ' not supported with save as
If f.Show = True Then
strF = f.SelectedItems(1)
strExt = Split(strFilter, "*")(1)
If InStr(strF, strExt) = 0 Then
' user did not type extension
strF = strF & strExt
End If
SaveFileName = strF
End If
End Function
After I create xls file, I opened this file. This is not Pivot tbl, look like I create this file from normal report.
When I try to open xlsx file I have an error: Format or file extension is not valid
Any Idea How to create ribbon bar with Button Export to Excel
Additional to this question How to add close button and send email to the same ribbon bar (using for Pivot table)
Thank you.
Mike
I have one pivot tbl and I need to export to Excel.
I create new ribbon bar with Export to Excel Button working find but when
I convert mdb file to mde I am loosing (not visible) excel button group name is here excel button is not.
I start using difference techniques:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="MyPivotTable" label="Pivot Table">
<group id="GroupPivotTableDataAccess" keytip="p" label="Pivot Table Data Access">
<button id="PivotExportToExcel" label="Excel"
imageMso="PivotExportToExcel" size="large"
onAction="=MyExportPivotTbl('XLS')"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
onAction="=MyExportPivotTbl('XLS')" I call procedure from module
Public Function MyExportPivotTbl(strFormat As String)
Dim strFileType As String
Dim strFileFilter As String
Dim strFileName As String
strFileType = acFormatXLS
strFileFilter = "*.XLS"
strFileName = SaveFileName(strFileType, strFileType, strFileFilter)
If strFileName <> "" Then
DoCmd.OutputTo acOutputForm, Screen.ActiveForm.name, strFileType, strFileName
End If
End Function
Public Function SaveFileName(strTitle As String, _
strFilterText As String, _
strFilter As String) As String
Dim f As FileDialog
Dim strF As String
Dim strExt As String
Set f = Application.FileDialog(msoFileDialogSaveAs)
f.Title = strTitle
'f.Filters.Add strFilterText, strFilter ' not supported with save as
If f.Show = True Then
strF = f.SelectedItems(1)
strExt = Split(strFilter, "*")(1)
If InStr(strF, strExt) = 0 Then
' user did not type extension
strF = strF & strExt
End If
SaveFileName = strF
End If
End Function
After I create xls file, I opened this file. This is not Pivot tbl, look like I create this file from normal report.
When I try to open xlsx file I have an error: Format or file extension is not valid
Any Idea How to create ribbon bar with Button Export to Excel
Additional to this question How to add close button and send email to the same ribbon bar (using for Pivot table)
Thank you.
Mike