Starting Explorer from VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

Does anyone know, how do I make a program, which opens Explorer and goes to www.microsoft.com? Idea is to create a button, which opens specific web address

Ecco
 
Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" (ByVal
hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal
lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long)
As Long

Sub test()
ShellExecute 0, "Open", "http://www.microsoft.com/", vbNullString,
vbNullString, vbNormalFocus
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


Ecco said:
Hello,

Does anyone know, how do I make a program, which opens Explorer and goes
to www.microsoft.com? Idea is to create a button, which opens specific web
address.
 
why not use a hyperlink?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Yep, that'll work too...

I just used my generic "open this" code. I sometimes don't see shortcuts.
 
Rob,

I was just offering the OP an alternative.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Did I come across defensively? I apologise.

I appreciate it when people correct me with a more elegant answer - it gives
me opportunity to learn.

Thanks :)
 
Rob,

Absolutely not, if anything from my experience of you I would say you are
overly self-effacing<G>.

I was trying to point out that I was really addressing the OP and that there
was no for you to justify yourself or anything else.

It's tricky this communication, so many opportunities for
mis-understandings<vbg>. No wonder we are coders.

Best Regards

Bob
 
Thanks.
Yes, I agree about this tricky communication. It has gotten better since the
two tones of the past (speaking and SHOUTING).

I've got a fair amount of programming experience but the frequent posters
have a lot of teach me yet - I'm relatively new here so I don't want to
steps on toes and lose that opportunity. (I've learned so much already!)

Cheers
 
Hey Rob,

So right. By the way, I visited your site and took a look at the picture
gallery. There seemed to be a significant omission there?

Bob
 
Rob

I downloaded your Blackjack.bas file and i get an error message sayin
COMPILE ERROR EXPECTED: IDENTIFYER on

Private Enum GameStat
 
Enum is not supported in Excel97 VBA and I don't have it to test
unfortunately.

You could try the following:
Replace:
Private Enum GameState
gstWaitingToDeal = 0
gstPlayerHand1 = 1
gstPlayerHand2 = 2
gstDealerHand = 3
End Enum

With:
Const gstWaitingToDeal = 0
Const gstPlayerHand1 = 1
Const gstPlayerHand2 = 2
Const gstDealerHand = 3

and

Replace:
Private CurrentGameState As GameState

With:
Private CurrentGameState As Long


Please let me know how that goes? If it works OK, I'll likely update the
code. Might as well be 97 compatible if the differences are that minor.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top