LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running a query from an open workbook

I am attempting to open two different queries in the same workbook, as
individual sheets. Whenever I run the code for the second query Excel open a
new workbook. Does anyone know how to retrieve the data into the current
workbook. The code I am using is a follows. Please bear with me I am very
new at using VBA.

'The first query has already ran and opened in Excel. Adding sheets for
next query.
Sheets.Add
Sheets("Sheet1").Select
Cells.Select

' Code to Navigate through the Database Setup
SendKeys ("{TAB}")
SendKeys ("~")

On Error GoTo errhandler

Workbooks.Open ("C:\Documents and Settings\dminor\Desktop\query\Blanket
Order Query.dqy")

errhandler:

If Err.Number = 1004 Then
Application.DisplayAlerts = False
Application.EnableEvents = False
ActiveWorkbook.Close SaveChanges:=False
Application.Quit

End If
Resume Next
End Sub


 
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
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 04:06 PM
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 04:02 PM
Running a macro in a open as read-o Workbook TBarreiro Excel Programming 0 September 2nd 05 03:55 PM
Application Error when running Macro on Workbook open TM[_2_] Excel Programming 1 October 2nd 03 10:53 AM
Application Error when running Macro on Workbook open TM[_2_] Excel Programming 0 September 15th 03 12:33 PM


All times are GMT +1. The time now is 08:01 AM.

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

About Us

"It's about Microsoft Excel"