Hide a worksheet in VB6 Automation Add In

B

Ben Litchfield

I have an Excel UDF implemented as a VB6 Automation Add-in. The function
executes as expected. As a side-effect of the function there are certain
cases where I want to hide the current sheet, seems pretty straightforward.


So I do this

oXL.ActiveWorkbook.ActiveSheet.Visible = xlSheetHidden

The code continues executing and runs, but the sheet is not hidden, it is
still there. I have tried a couple different things but no luck, is this
possible from an Excel add-in? When I pop up a message box to display the
value of ActiveSheet.Visible, the value is "-1" both before and after I
attempt to set it. The ActiveSheet is valid because I can display the Name
property and it is as expected.

I have the same code in a Macro and it works fine, so I think there is
something to do with the fact that it is in an automation add-in.

Any thoughts?

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top