[AccessD] Open Excel workbook from Access 2000

RANDALL R ANTHONY RRANTHON at sentara.com
Mon Dec 21 12:34:55 CST 2009


This is what works for me.
 Dim oXL As Excel.Application
 oXLBook As Workbook
 oxlsheet As Worksheet

 'open the spreadsheet
    Set oXL = New Excel.Application
    Set oXLBook = oXL.Workbooks.ADD
    oXL.Visible = True
    oXLBook.Activate

>>> On 12/21/2009 at 1:21 PM, in message <1CF20DB644BE124083B31638E5D5C0234A2087 at exch2.Onappsad.net>, "Joe O'Connell" <joeo at appoli.com> wrote:
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 ( http://www.databaseadvisors.com/ )



More information about the AccessD mailing list