S
Stephen sjw_ost
Hello,
I am trying to automate Excel with Access and have been trying to convert
this Excel code to work from Access.
Sub DoIt1()
'
' This macro places a shape ,triangle, on the selected sheet to make a
"Please wait sign".
'
Application.ScreenUpdating = True
With Sheet2.Shapes("AutoShape 6")
.Visible = msoTrue = (Not Sheet2.Shapes("AutoShape 6").Visible)
End With
With Sheet2.Shapes("AutoShape 6")
.Visible = msoFalse = (Not Sheet2.Shapes("AutoShape 6").Visible)
Application.StatusBar = False
End With
Sheet2.Select
End Sub
I have added in my References the "Microsoft Excel 11.0 Object Library" and
am using the following to automate Excel with;
Public xApp As Excel.Application
Public xBook As Excel.Application
Sheet2 = sheets name "Options"
Here is my attempt to convert the Excel code to work from Access with no luck;
Function DoIt()
Set xApp = GetObject(, "Excel.Application")
Set xBook = xApp.ActiveWorkbook
' This macro places a shape ,triangle, on the selected sheet to make a
"Please wait sign".
xBook.Sheets("Options").Activate
With xBook.Sheets("Options").Shapes("AutoShape 6")
.Visible = xApp.Workbook.msoTrue = (Not
xBook.Sheets("Options").Shapes("AutoShape 6").Visible)
End With
With xBook.Sheet2.Shapes("AutoShape 6")
.Visible = xApp.Workbook.msoFalse = (Not
xBook.Sheets("Options").Shapes("AutoShape 6").Visible)
End With
xBook.Sheets("Options").Select
End Function
This code does compile in Access but it will not automate Excel with the
desired result which is to open a hidden triangle object on Sheet2 "Options"
to let the user know something is running. I get the error;
Run-time error '438';
Object doesn't support this property or method
The error occurs in the 1st With/End With on the .Visible
As always, any help is greatly appreciated.
Stephen
I am trying to automate Excel with Access and have been trying to convert
this Excel code to work from Access.
Sub DoIt1()
'
' This macro places a shape ,triangle, on the selected sheet to make a
"Please wait sign".
'
Application.ScreenUpdating = True
With Sheet2.Shapes("AutoShape 6")
.Visible = msoTrue = (Not Sheet2.Shapes("AutoShape 6").Visible)
End With
With Sheet2.Shapes("AutoShape 6")
.Visible = msoFalse = (Not Sheet2.Shapes("AutoShape 6").Visible)
Application.StatusBar = False
End With
Sheet2.Select
End Sub
I have added in my References the "Microsoft Excel 11.0 Object Library" and
am using the following to automate Excel with;
Public xApp As Excel.Application
Public xBook As Excel.Application
Sheet2 = sheets name "Options"
Here is my attempt to convert the Excel code to work from Access with no luck;
Function DoIt()
Set xApp = GetObject(, "Excel.Application")
Set xBook = xApp.ActiveWorkbook
' This macro places a shape ,triangle, on the selected sheet to make a
"Please wait sign".
xBook.Sheets("Options").Activate
With xBook.Sheets("Options").Shapes("AutoShape 6")
.Visible = xApp.Workbook.msoTrue = (Not
xBook.Sheets("Options").Shapes("AutoShape 6").Visible)
End With
With xBook.Sheet2.Shapes("AutoShape 6")
.Visible = xApp.Workbook.msoFalse = (Not
xBook.Sheets("Options").Shapes("AutoShape 6").Visible)
End With
xBook.Sheets("Options").Select
End Function
This code does compile in Access but it will not automate Excel with the
desired result which is to open a hidden triangle object on Sheet2 "Options"
to let the user know something is running. I get the error;
Run-time error '438';
Object doesn't support this property or method
The error occurs in the 1st With/End With on the .Visible
As always, any help is greatly appreciated.
Stephen