Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default One subroutine to run another

I have a process where I run a query and then send those results
directly to Excel.

I want to have the user click the button - run the query through one
subroutine and then after that sub is done run the subroutine that
transfers to Excel. Simply, all I'm looking for is the code that I
put in the first sub that executes the second sub at the right time.

Here are the subs

Private Sub OpenMonthlyReportForm_Click()
On Error GoTo Err_penMonthlyReportForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "MonthlyReport Calendar"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_penMonthlyReportForm_Click:
Exit Sub

Err_penMonthlyReportForm_Click:
MsgBox Err.Description
Resume Exit_penMonthlyReportForm_Click

End Sub

Then to transfer this is the sub

Private Sub MonthlyReport_Click()
On Error GoTo Err_MonthlyReport_Click

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"sumquery", "C:\MonthlyReport.xls", True
Application.FollowHyperlink "C:\MonthlyReport.xls"

Exit_MonthlyReport_Click:
Exit Sub

Err_MonthlyReport_Click:
MsgBox Err.Description
Resume Exit_MonthlyReport_Click

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call a subroutine using variable subroutine name dhstein Excel Discussion (Misc queries) 3 July 26th 09 08:28 PM
SUBROUTINE HELP biker man Excel Discussion (Misc queries) 1 July 28th 07 04:06 PM
VB subroutine Noel Rietman Excel Programming 0 October 19th 06 07:50 PM
end subroutine melric Excel Programming 3 March 31st 05 12:32 AM
Every second subroutine dolegow Excel Programming 1 October 12th 03 02:11 AM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"