View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Open Excel from access

See this page also
http://www.erlandsendata.no/english/...php?t=envbaole

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message ...
Try it with the version number in the code like this

10 =2002
9=2000

Sub test()
On Error Resume Next
Set xl = GetObject(, "Excel.Application.10")
If xl Is Nothing Then
Set xl = GetObject("", "Excel.Application.10")
xl.workbooks.Open "C:\Data\book1.xls"
xl.UserControl = True
xl.Visible = True
End If
AppActivate "Microsoft Excel"
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"John" wrote in message ...
Dear Ron,

The code did not work, it did not understand this part of
the code: AppActivate "Microsoft Excel"

If you have any other suggestions that would be great.

Thanks again,
John


-----Original Message-----
Try this in Access

Sub test()
On Error Resume Next
Set xl = GetObject(, "Excel.Application")
If xl Is Nothing Then
Set xl = GetObject("", "Excel.Application")
xl.workbooks.Open "C:\Data\book1.xls"
xl.UserControl = True
xl.Visible = True
End If
AppActivate "Microsoft Excel"
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl