Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a Macro from within Onedrive 1

Status
Not open for further replies.

Clyde38

Electrical
Oct 31, 2003
533
I have Excel spreadsheets that I would like to allow access to from my website. Using Onedrive, I can embed the HTML code for the spreadsheet in the website and allow access to anyone. This does not work with the macro's that I have in the spreadsheet because I use a graphic or button to run the macro. How can I run the macro without a graphic or button? For instance, is there a command that will run the macro when a cell has changed or when a recalculation occurs?
 
Replies continue below

Recommended for you

As far as I know you can't run VBA macros when running Excel through a browser. You can open Excel from Onedrive, but then you have access to all graphics and other facilities, so I presume that is not what you are doing.

You can write VBA code to run a macro when certain events occur, or you can access a list of all macros by pressing Alt-F8, but neither will won't work from a browser.

As far as I know your only option is to re-write the macro in JavaScript.

Doug Jenkins
Interactive Design Services
 
Hi Doug,

Thanks, I'm going to try the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$3" Then
Call My Macro
End If
End Sub

This works in Excel 365 so I'll try it via the website.
 
As you stated, this did not work. I do not know how to write the macro in JavaScript, so I guess I'm out of luck. Thanks anyway for your advice.
 
The lack of support for improving and extending VBA in Excel is very frustrating, but it seems that Microsoft see VBA as a legacy application that has no place in their vision for the future. I think this is a huge wasted opportunity for them, but I don't see any prospect of things changing.

If I do come across a way forward (with a manageable learning curve) I'll post here (but I wouldn't hold your breath).

Doug Jenkins
Interactive Design Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor