[AccessD] Open Excel workbook from Access 2000

Gustav Brock Gustav at cactus.dk
Mon Dec 21 12:29:34 CST 2009


Hi Joe

Try with:

    Set excelapp = CreateObject("Excel.Application")
    Set excelWb = excelapp.Workbooks.Open(strWB, , True)
    Set excelSheet = excelWb.Worksheets(strSheet)

    excelSheet.Visible = True
    excelSheet.Activate

/gustav


>>> joeo at appoli.com 21-12-2009 19:21:35 >>>
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





More information about the AccessD mailing list