views:

475

answers:

3

Hi,

I am a mechanical engineer who has recently dabbled with VBA in Microsoft Excel (Office 2003). I have created an excel (.xls) file (created macro using VBA). The excel file is protected and has hidden worksheets. When I try to run the excel macro in Internet Explorer, I get an error message "Method of class "Sheets" failed in object _Global". The macro runs fine in Excel.

So, I'm guessing that IE doesn't access the worksheets (hidden or otherwise) the Excel Workbook.

Is there a way to declare the "sheets" or "worksheets" variable in my Excel VBA code so that the Excel macros can run in the IE window as well? Is there a workaround to fix this problem? P.S.: I have to run the macro in IE.

Thanks in advance. -Rishi

A: 

I don't understand what you're doing. The Excel macros runs only on Excel. May be you download a Excel file, and the macros doesn't run? If you need a macro for IE, [check this][1]

[1]: http://download.cnet.com/iMacros-for-Internet-Explorer/3000-12512_4-10586882.html/"check this"

Apocatastasis
Excel workbooks can be hosted and viewed through IE. http://support.microsoft.com/kb/164384
Irwin M. Fletcher
I'm trying to run the Microsoft Excel file in an Internet Explorer window (embedded). This is for multiple people to use through the intranet.
I think I misunderstood you intent at first, you can not host an Excel spreadsheet with Macro functionality. When you save the file as a htm page, then all of the Macros are stripped out.
Irwin M. Fletcher
Okay...I was hoping to hear something different.Thank you very much for your time, Irwin.
+1  A: 

You can offer your Excelfile for download. This way each user can run it on his/her own machine. Just provide a link to its location on a Web page, then the user can decide to download or run immediately. Naturally any modifications the user does, would not flow back into the source.

MikeD
A: 

Hi...

I found out what the issue was in my case. When the Excel file is opened in Internet Explorer, the sheets that are being accessed will have to be un-hidden and selected

In my case: Application.ThisWorkbook.Sheets("Hose_Blk_mtrl").Visible = True Application.ThisWorkbook.Sheets("Hose_Blk_mtrl").Select

Also, the Workbook should be "UnProtected" so that the above two lines in code will not generate any error. The Worksheets can be hidden again after the execution of the code by

Application.ThisWorkbook.Sheets("Hose_Blk_mtrl").Visible = False

So, Internet Explore CAN host excel files with in-built Macros.

-Rishi