Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 8th, 2004, 06:54 PM
Harold Harold is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 2 Harold User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
  #2  
Old December 9th, 2004, 12:00 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Looking for VBA code for menu path


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT