![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 2
|
I have an Access application that queries a seperate database and then transfers this data to Excel for computing and generating charts, ect and then storing the results historically (in Excel). I'd like to be able to put a command button on my Access user form that will open the desired Excel worksheet to display historical data without running through the entire query process. I have the button in place, but am missing something in the code. Currently I can get Excel to open, but can't get the sheet to activate. Is there a simple way around this ? Any help would be greatly appreciated.
Thanks, Mike [ This Message was edited by: mfhoward2 on 2002-05-15 11:17 ] |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
Quote:
This code opens a file in Excel and then activates the workbook. If this isn't what you're after then it may be worth posting your code. Regards, Dan Code:
Private Sub Command0_Click()
Dim xlApp As Object, xlWb As Object
On Error Resume Next
Set xlApp = GetObject(, "EXCEL.APPLICATION") 'Try and get a running instance of Excel
If Err.Number <> 0 Then 'Excel isn't running
Set xlApp = CreateObject("EXCEL.APPLICATION")
End If
Set xlWb = xlApp.workbooks.Open("C:tempdan.xls")
xlApp.Visible = True
End Sub
|
|
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2002
Posts: 2
|
Thanks Dan !! That did the trick. I think I was just failing to set the app as "visible". Greatly appreciate the help !
Best Regards, Mike |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|