Solved

Macro/Code To Open Launch URL in Cell

Posted on 2013-01-14
13
365 Views
Last Modified: 2013-01-26
Hello Experts,

I'm looking for a code, that will do a couple of things. But I would imagine, the coding itself would be super easy - just not for someone like me.

The code would need to do this...

Step 1:  Check to see if cells, A1, B1, C1 have values - IF YES, then continue to step 2. (IF NO, then do nothing.)

Step 2:  Open the URL, located in cell D1.  And by open, I mean automatically open my browser window (if possible) to the URL that is located in the cell.

Thank you in advance for your help!

~ Geekamo
0
Comment
Question by:Geekamo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 1

Author Comment

by:Geekamo
ID: 38776929
I forgot to mention, I plan on having a button - when pressed, then the code runs.
0
 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
ID: 38777031
Hi, Geekamo.

Please see attached. The code is...
Option Explicit

Sub Goto_Web()

If Range("A1") <> "" And Range("B1") <> "" And Range("C1") <> "" And Range("D1") <> "" Then
    ActiveWorkbook.FollowHyperlink Address:=Range("D1").Value
End If

End Sub

Open in new window

Regards,
Brian.Goto-Web.xlsm
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38785621
@ Brian

The code you created worked great on my home computer (Macbook Air) without any hiccups, however on my work computer (PC) - when the code was run, Excel basically freezes and Internet Explorer fails to load.

Any ideas?

If this is just some weird glitch, that I can't technically troubleshoot as much because it's a work computer - I wonder if my solution would be to have the code just copy that URL into memory, so the user can just paste the URL into Internet Explorer on their own.

What do you think?

~ Geekamo
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 26

Expert Comment

by:redmondb
ID: 38785675
Geekamo,

Let's experiment. The attached has three extra ways for getting the data, please try each one...
(1) Click on D10 - it should open a new page in your browser.
(2) Click on D11 - it should open a new page in your browser.
(3) On the Ribbon's menu bar, click on "Data", then click on the "Refresh All" button. This should import the page's details into the yellow cells.

Let me know what happens for each, please.

Thanks,
Brian.Goto-Web-V2.xlsm
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38785704
@ Brian,

Hmm, I tried looking for your code in this workbook - but I was unable to find it? Are you hiding it?  Not sure if I'm missing something here.

As for the steps,...

Step 1 - Did not open my browser. (I do see the URL, but it doesn't appear blue like a hyperlink would)
Step 2 - Did not open my browser. (I clicked, but the cell appears empty to me?)
Step 3 - It loaded text from I guess Office.com, all the way down the yellow column.

I'm testing this on my Macbook Air, but I'm a little hesitant testing the workbook on my work computer if I can't see the code.  So now I'm back to my first question, is it blocked or am I just missing something here?

This is all French to me!  :-)

~ Geekamo
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38785740
Thanks, Geekamo.

There is no code - other than that already in the first file.

Options 1 & 2 are simply the two types of hyperlinks, while the "yellow" data is a connection. To see exactly what they are...
 - Right-click on D10 and select "Edit Hyperlink...".
 - D11 is simply a formula.
 - On the Ribbon's menu bar, click on "Data". Click on "Connections". You'll see a single connection called "Connection". Click the "Properties..." button and then the "Definition" tab. In "Connection String" you'll see the address being used.

I've no experience of Macs so I don't know why (1) and (2) didn't work. Hopefully the above will give you enough confidence to try them on your work PC.

Regards,
Brian.
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38785780
@ Brian,

Wow, tonight isn't my night.  Options 1 & 2, - YES, they work.  I was looking at the wrong cells. lol Ugh.  As for checking the connection thing, I don't see it. So maybe my Mac version doesn't support that? (I've included a screenshot)

~ Geekamo
Screen-Shot-2013-01-16-at-11.56..png
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38785790
Geekamo,

Thanks!

As for checking the connection thing, I don't see it.
Yes, the Mac looks quite different to a PC. A number of options...
 - Click on G1 - did new entries appear in the Ribbon?
 - Click on G1 - check the options available in the "Refresh" drop-down.
 - Do a search in Help for "Connection Properties" or similar.
 - Check out the Connection properties on your work PC before doing a Refresh.

Regards,
Brian.
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38785856
@ Brian,

Nope, there doesn't appear to be anything new.  Ok, I will look into "Connection Properties" for Excel Mac version. And I'll let you know what happens with my work computer.

~ Geekamo
Screen-Shot-2013-01-17-at-12.40..png
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38785866
Thanks, Geekamo. Interesting that "Parameters" is greyed out.
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38823330
Thanks, Geeka. All OK with the work computer? Did you get the Connection issued on the MAC?
0
 
LVL 1

Author Comment

by:Geekamo
ID: 38823334
Brian,

Not exactly.  This project has been put on the back burner so I haven't had the time to invest into trouble shooting it further.  Your first solution did work, on my Mac computer - so as far as I was concerned the points were yours.

~ Geekamo
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38823442
Thanks for the update Geekamo. If the clock starts again and you have any issues, please feel free to post here. (Apologies, after a week or so, it might take me a few days to notice a new post.)
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question