|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Looking for VBA code for menu path
I am trying to find VBA code that would allow me to code the menu path:
Tools --> Office Links --> Analyze using Excel and close Access automatically after running a Crosstab query so that I would end up with an Excel spreadsheet in Excel. Thanks much! |
|
#2
|
|||
|
|||
|
Harold,
Here is some VBA code that will transfer your crosstab query into Excel and then open the Excel application and close Access. Dim objXL As Object Dim strFile As String strFile = "C:\Documents and Settings\user\My Documents\qryCrosstab.xls" DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "qryCrosstab", strFile Set objXL = CreateObject("Excel.Application") With objXL.Application .Visible = True .Workbooks.Open strFile End With Set objXL = Nothing Application.Quit Replace the user with your user name and qryCrosstab with the name of your crosstab query. You can change the name or the directory to store your Excel file in to where ever you want to keep it. The above puts the Excel file into My Documents with the file name qryCrosstab.xls lwells |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Looking for VBA code for menu path |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|