473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Open Hyperlink Minimized or Hidden

I'm trying to open an hyperlink, which is in fact an online streaming station, with a macro in Excel, like:
Expand|Select|Wrap|Line Numbers
  1. Sub MyMacro()
  2.  
  3. ActiveWorkbook.FollowHyperlink Address:="http://www.lmradio.net/streaming.html"
  4.  
  5. End Sub
But the page opens in full screen format and I want it to open minimized with the focus on the Excel sheet or hidden.

Can you help me?

Thanks.
Nov 8 '13 #1

✓ answered by zmbd

(*)(--- A thought, as I was replying, I hit on the AppActivate Application.Name while trying to set the focus back to your workbook (scroll to the bottom (^-^) ). You might just try sticking this after your current code and see if this works for you. I leave the rest of the reply just incase this doesn't suit your needs ---)

First look into that USER32.DLL
I don't do a lot of API calls; thus, I would rather have you find one that is tested and works instead of giving you bad information.

Once you understand how that API call works, then it should be straight forward from there...
You need the instance first... this will follow the same type of code as for Office Automation, you'll just be using the IE instead of Outlook or Excel as given in these examples... Office application automation
If this is going to be ran only on your PC then go in the VBE and set the reference as I gave you in my last post so that you have the intellisense and constants to work with for IE (and in the object browser you can see the object model! (The Internet Explorer Object Model This reference is to VBS so there are some slight differences; however, the model should be the same for our needs here)

Now using the same type of construct as in the automation article I linked you to, create your IE object (IEOBJ). Using the model information you should be able to set the navigation etc... Just make sure that you make the application object visible or you will have a huge mess on your hands as you open more and more IEOBJ without an easy way to close them!

Now, if I remember correctly, the IEOBJ.HWND is what you'll need to pass to the API call to minimize the window.

(*) Once you do that then in the code following the API call you'll need something that sets the focus back to your workbook... I would think: AppActivate Application.Name would do it if you have only one Workbook open then this should force the Excel forward. In fact, you may not even need the API call to minimize the IEOBJ (hmmm that may actually work under the KISS concept and what I should have started with upon reflection).

In anycase, let us know what happens.

8 6556
NeoPa
32,556 Expert Mod 16PB
It doesn't appear that there is a parameter to specify that it be opened as minimised. Not sure if this is possible.
Nov 9 '13 #2
zmbd
5,501 Expert Mod 4TB
If I remember correctly, IE is instanced as an object, then the URL is navigated to, then there is an API call to minimize the IEObject window.
Nov 11 '13 #3
@zmbd
I'm sorry, can you be more specific? I don't really know how to put it any other way. The link opens the page correctly but the opened window comes to the the front of the Excel window and I want it minimized or in the background, keeping the focus on the spreadsheet. Of course, I can do it (minimize de window) manually, but then again in that case I wouldn't come here for help. Thanks, anyaway!
Nov 13 '13 #4
@zmbd
You mean: object.ClientToWindow? I've tried but returns an error!
Nov 13 '13 #5
zmbd
5,501 Expert Mod 4TB
jacaranda :

What you are trying to do is not routinely done; thus, the lack of an easy way to accomplish your goal. The routine situation is to open a hyperlinked file and set focus to it... otherwise, why open the object?

BTAIM:
Instancing an object can be done via either early or late binding.
Early binding: You will need to find the object library via the VBE/Tools/References that applies to object-model in question. In this case, Microsoft Internet Explorer Controls. This provides the constants and intelisense that we've all grown to love and depend on; however, if your next PC doesn't have this reference set, then the code chokes.

Hence:
Late Binding: In this case you will declare applicaiton level objects and will have to know the object-model and the constaints. There are some advantages for this method too; however, I leave that to the programmers to better explain than I would be able to do... for me the advantage is that I can build the application without having to worry about having the reference set out in the lab/client PC.

To instance the object, you need to first declare
DIM instanceofobject AS __
then set the object
set instanceofobject = ___

Notice I didn't fill in the blank... because what goes there depends on early or late binding.

In either case, once the IE object has been setup/created/instanced then you can tell it navigate to a webpage, etc... HOWEVER, for some reason one still can not minimize the window. You can however, leave it hidden - I warn you NOT to do that! If you leave it hidden, then it continues to run without any easy way to terminate the session, which takes up resources, and your end-users will hunt you down like a rabbid-zombie.

So how to minimize, You can set the height and widith of the IE-Obj, or you can do an API call (I think it is a User32.DLL; however, with the newer 64bit PC/OS I'm not absolutly sure about this anymore) passing on the handle of the open IE-Obj to the call to minimize its window.

You should be able to find some code snips that handle your situation.

-

I've also deleted one of your posts to this thread: It doesn't pay to antagonize members of any forum, be it here, "answers.*.com," "utter...," etc... You will find that the same people tend to be active and well respected members at all of these sites and many, many more; thus, you might find that no help from anyone anywhere by any site's membership.

Moderators such as Neopa and Myself, or the various Experts will tend to answer to the best of our knowledge - even if we are not sure of the answer, for mainly two reasons:
1) and formost: So that YOU the poster know that we've seen the thread. IMHO, there are very few things more frustrating than seeing a count of 200+ views and not a single answer or even so much as a Boo-I-Saw-You.
2) to start the conversation. Just because one of us doesn't have the exact answer doesn't mean what we do know wont jog the memory of someone else that will be able to provide an answer.

Finally, and with the utmost Respect, Bytes is neither a code writing nor homework service. Please keep in mind that moderators, experts, and others are un-paid volunteers that attempt to provide some help and guidance in-between our obligations to work and family.

Please be patient, we're doing the best we can to answer a question, especially on holidays and busy posting days.
Nov 13 '13 #6
@zmbd
You are absolutely right: Why open it? Ok, this is the case:
The Excel spreadsheet shows me a Radio Station's complete schedule for the week. Several Excel functions tell me exactely which DJ is on the air any time, with his name, photo, program name and timetables. Until here all's well!
However when the workbook opens, the macro Workbook_Open is "fired", opening a link to the streaming html page, so that I can hear the radio station it in the background (preferably), but not in the foreground, because the window of the audiostream page comes in front of the spreadsheet. For this reason I want it minimized or in the background, so that I can see the information on the spreadsheet, without having to minimize it manually. Minimize, not close! If I close it I will lose the sound.
Any help would be much appreciated.
If you can't help, ok! Friends, as before!
FY
Nov 14 '13 #7
zmbd
5,501 Expert Mod 4TB
(*)(--- A thought, as I was replying, I hit on the AppActivate Application.Name while trying to set the focus back to your workbook (scroll to the bottom (^-^) ). You might just try sticking this after your current code and see if this works for you. I leave the rest of the reply just incase this doesn't suit your needs ---)

First look into that USER32.DLL
I don't do a lot of API calls; thus, I would rather have you find one that is tested and works instead of giving you bad information.

Once you understand how that API call works, then it should be straight forward from there...
You need the instance first... this will follow the same type of code as for Office Automation, you'll just be using the IE instead of Outlook or Excel as given in these examples... Office application automation
If this is going to be ran only on your PC then go in the VBE and set the reference as I gave you in my last post so that you have the intellisense and constants to work with for IE (and in the object browser you can see the object model! (The Internet Explorer Object Model This reference is to VBS so there are some slight differences; however, the model should be the same for our needs here)

Now using the same type of construct as in the automation article I linked you to, create your IE object (IEOBJ). Using the model information you should be able to set the navigation etc... Just make sure that you make the application object visible or you will have a huge mess on your hands as you open more and more IEOBJ without an easy way to close them!

Now, if I remember correctly, the IEOBJ.HWND is what you'll need to pass to the API call to minimize the window.

(*) Once you do that then in the code following the API call you'll need something that sets the focus back to your workbook... I would think: AppActivate Application.Name would do it if you have only one Workbook open then this should force the Excel forward. In fact, you may not even need the API call to minimize the IEOBJ (hmmm that may actually work under the KISS concept and what I should have started with upon reflection).

In anycase, let us know what happens.
Nov 14 '13 #8
Wow, thank you very much for your help. I promise you I will pay my utmost attention to the contents of the link you kindly sent me (IEOBJ). It'll be my first contact with this tool but I'm a fast learner. Thank You & all the best.
FY
Nov 15 '13 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

40
by: Brian Jorgenson | last post by:
On my web page, I have a few hyperlinks with target frame of _blank. The hyperlink brings up a second window, but everytime I click on thie hperlink, it keeps bringing up a new window and not...
1
by: divya kr swami | last post by:
i have open a window javascript that should be close after 5 second. for this i have used following code. function GetMessage() { ...
0
by: Josh | last post by:
How can I set a hyperlink in my data list to open a new window? TIA Josh
0
by: Stevestan1 | last post by:
Is there a keyboard process to open a hyperlink in an e-mail in Outlook 2007? Thanks
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.