[AccessD] Open Excel workbook from Access 2000

Andy Lacey andy at minstersystems.co.uk
Mon Dec 21 12:28:53 CST 2009


Hi Joe

I think it's the Excel app you need to make visible. Try

Excelapp.Visible=True

Andy

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe O'Connell
Sent: 21 December 2009 18:22
To: Access Developers discussion and problem solving
Subject: [AccessD] Open Excel workbook from Access 2000


I need to open a specific sheet in an Excel workbook from Access 2000.
There is no problem opening the workbook, the list of processes shows
that Excel is running.  The problem is that the workbook is not visible.
The statement to display the workbook ("excelWb.Visible = True") fails
with an error "Object does not support this object or method".

Does anyone know the correct syntax to display the workbook?

The code is:

Public Sub OpenSheet( strWB, strSheet)

    Dim excelapp As Excel.Application
    Dim excelWb As Excel.Workbook
    Dim excelSheet As Excel.Worksheet
    
    Set excelapp = CreateObject("Excel.Application")
    Set excelWb = excelapp.Workbooks.Open(strWB, , True)
    excelWb.Worksheets(strSheet).Activate

    excelWb.Visible = True

End Sub


Joe O'Connell

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list