I guess you can add an event on webbrowser active x to monitor which URLs are getting requested and fire the macro when URLs match. I have never worked with browser object thru excel, so no idea what events it supports.
@ Chandoo Key Master (my question a little more clear),
I am still new to all of this (and not quite sure how to add an active X event monitor to my links).
I basically have a web browser embed in my excel sheet (the html page is simply a page with shortcuts).
It all started off as simple jpg buttons and shapes linked to different things (basic add link function in excel), and then I wanted to get glamorous with the links and came up with this idea...
It is basically a web page full of flash based fancy shortcuts (that's pretty much it). It works the same way (only through a web browser object). It looks pretty neat and adds style to my excel page (I use these links a lot).
However, now I wonder if I could I use those links to trigger macros from within the excel sheet?
It would give a more seamless and well designed feel to the entire excel sheet if that were possible.
As you can imagine.. firing excel macros from browser would be pretty deep security hole. So there is no natural way to do this (as far as I know). But you can use browser object's events to do something like this.
Btw, if all you want are flash buttons, why not embed them directly in Excel using flash objects? That way you could run macros from _onlick() event...?
When you say a web browser embeded.., are you referring to an actual web browser where you can surf the net, or is it a screen that looks like it has a number of links and other objects so it appears like a web browser ?
I just inserted a web browser object in to a work sheet to see what events it supports.
After you add the object, right click on it and select view code.
Here you can add events for the browser. For example an event macro like "titlechange" will fire whenever underlying page's title changes (ie, when you click on a url, if the target page has diff. title than existing pages title, excel will run the code inside this macro.)
You can use this to do what you are looking for.
But the best and easiest way is to use buttons and links directly on excel. It is much more simple and easier that way.
Is their a reference resource article or something to that effect for the event macros (like "titlechange")? I mean, as far as the event codes, I just would like to name my flash buttons what they do (like highlight entire row, or sort column from Z to A) for instance -simple buttons like that.
I'm sure I can just pop a sort column code in the web browser section of view code.. but what and where does the extra code go that tells the browser to run this code I guess is what I'm trying to say.
Of course regular buttons are easier, but I got into this excel VB game to do the extraordinary.
I would strongly recomend against using a web browser within excel as an interface, This will be very difficult to maintain, will have inherent security issues and I think will be more trouble than it is worth in developing.
Excel has a good collection of tools for development of interfaces to nearly anything
You can use inbuilt buttons, custom buttons/shapes and have macros or links connected to them. A lot of the management can be done without code, as it is inbuilt within the tools.
You can lock the tools down so that they cannot be moved edited etc.
I would refer you to the spreadsheets at http://chandoo.org/wp/2010/07/16/download-expense-trackers/
These are great example of what can be done with minimal work within Excel