By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,645 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Opening a webpage with a command button

P: 11
Can I create a command button that opens IE and pass an associated website address to target? In other words, I list a text link in a form. If I add a button what is the event procedure I need to create to pass along the actual url to IE?
Feb 14 '07 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,638
Can I create a command button that opens IE and pass an associated website address to target? In other words, I list a text link in a form. If I add a button what is the event procedure I need to create to pass along the actual url to IE?
The 'No Frills' and 'Simplest' approach by far is:
__1 Assuming a Text Box on your Form named txtURL.
__2 Typing a Internet Address into this Text Box. e.g. yahoo.com, microsoft.com, etc.and placing this code in the Click() Event of a Command Button will navigate to that location assuming it is a valid Address.
__3 You must know the Absolute Path to Internet Explorer for this to work.
__4 An invalid address will simply produce the This Page cannot be displayed screen within IE.
__5 You may also want to look into the possibility of incorporating a Microsoft Web Browser Control into your application.
Expand|Select|Wrap|Line Numbers
  1. If Len(Me![txtURL]) > 0 Then
  2.   Dim retVal
  3.   retVal = Shell("C:\Program Files\Internet Explorer\Iexplore.exe " & Me![txtURL], vbMaximizedFocus)
  4. Else
  5.   Exit Sub
  6. End If
Feb 15 '07 #2

P: 11
That worked perfectly! No frills was easy and easy is for me!
Feb 16 '07 #3

P: 11
Thank you!
Feb 16 '07 #4

ADezii
Expert 5K+
P: 8,638
Thank you!
You're quite welcome.
Feb 16 '07 #5

Post your reply

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