PDA

View Full Version : Macro to set specified web link as default homepage



colibri
07-05-2005, 03:23 AM
I try to create right macro for MS Word, for document Document_Open() event.

Macro need run automatically when this document is opened, at document Document_Open() event. Not for global procedure.

Macro just need set specified web link (url specified in macro code) as default homepage in Internet Explorer(and for other browsers if possible). When user open Internet Explorer, it will always see this default homepage. Also, macro need automatically add this webpage to favourites folder. However, when user open doc repeatedly, macro first should check is the default homepage set as required and is this page in favourites or not. If macro find that this already exist -just exit.

thanks,
colibri
:help

fumei
07-08-2005, 08:57 AM
Post code.

MOS MASTER
07-08-2005, 09:21 AM
From within a browser with JavaScript this is easy....but I haven't done this before with VBA in Office automation...

I highly doubt that it is easily achieved. :whistle:

colibri
07-08-2005, 11:44 AM
From within a browser with JavaScript this is easy....but I haven't done this before with VBA in Office automation...

I highly doubt that it is easily achieved. :whistle:

Its an idea state still, I have no code yet; but why you think that it difficultly to achieve use macro?

MOS MASTER
07-08-2005, 11:49 AM
Its an idea state still, I have no code yet; but why you think that it difficultly to achieve use macro?
Hi, :yes

Well Internet Explorer is not part of the Office collection so you need a IE Object to reference. In that way it's not a normal request for VBA.

I know it's possible to program some of the IE Object but I doubt if the things you want are there for the take. (In methods that is)
I also thought somewhere in the Shell objects you could find IE stuff to but it has been a while..

Within web coding it's a normal thing to do so methods are provided to do it easily...

So that's why I think it's difficult. :whistle:

colibri
07-08-2005, 11:58 AM
Hi,

yes, its really looks no so easy I expected..

:confused:

colibri

MOS MASTER
07-08-2005, 12:04 PM
Hi,

yes, its really looks no so easy I expected..

:confused:

colibri
Well perhaps someone comes by who has done it before and relieve you.

Gerry also posted in this question so perhaps he has a clue.

Later :whistle:

Ken Puls
07-08-2005, 12:39 PM
I thought I'd looked at this a long time ago, although I can't remember why. Probably someone else asked.

As I recall, even when you bind to the Internet Explorer object model, the homepage property is not exposed to view, much less edit. I think that the reason for this was to prevent hijicaking the home page URL and setting it to a vicious site.

I could be corrected on this, but that was my recollection... and even if I am right, it doesn't mean that there isn't an API to do it or something else.

MOS MASTER
07-08-2005, 12:48 PM
Hi Ken, :yes

Like I said I had the same feeling I saw it somewhere before..(I'm sure it's in Shell)...but it has been to long and I know about the troubles...

But don't forget within IE ((D)Html/Javascript)..it's very easy.

If I find the time I'll go and hunt for it. :whip

Ken Puls
07-08-2005, 12:54 PM
Hey Joost,

LOL! I only use IE when I have to, as I'm a Firefox guy now. My experience with Javascript is pretty limited too, so can't contribute much on that front!

MOS MASTER
07-08-2005, 12:57 PM
Hehehe..see my Avatar..which browser do you think I use? :motz2:

But I can't live without IE because Windows and stuff needs updating h?..:yes

colibri
07-09-2005, 11:01 AM
I considered the solution and I think I find the convenient way. The optimal solution would be to create small standallone application in pure C, which will do the mentioned task, then convert it into ASCII text format (use some binary to ASCII converter), then insert this ASCII code into a macro, so macro task is just convert it back to exe and run. It would not be difficult.

MOS MASTER
07-09-2005, 12:02 PM
I considered the solution and I think I find the convenient way. The optimal solution would be to create small standallone application in pure C, which will do the mentioned task, then convert it into ASCII text format (use some binary to ASCII converter), then insert this ASCII code into a macro, so macro task is just convert it back to exe and run. It would not be difficult.
Well I have no idea how this sollution is going to work.

But if it works for you all the better. :thumb