View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_8_] Harald Staff[_8_] is offline
external usenet poster
 
Posts: 28
Default VBA Code== Goto a webpage using a command button in a UserForm

There are times when ActiveWorkbook is Nothing and the code fails, like when
no workbooks are open, or if the active one is in "protected mode" or
something like that, new stuff. The easy for the developer, but for the user
rather confusing, workaround is

If ActiveWorkbook Is Nothing Then
Workbooks.Add (1)
Doevents
End If
ActiveWorkbook.FollowHyperlink "https://www.google.com/"

... Garry's first method is a far smoother user experience at least in those
cases.

Best wishes Harald

"Michael Davis" skrev i melding
...
On Saturday, August 17, 2013 4:53:26 AM UTC-4, Harald Staff wrote:
Just to mention an alternative:



Sub Click()

ActiveWorkbook.FollowHyperlink "https://www.google.com/"

End Sub

This worked perfectly. if this is the alternative, yet works so simply,
why use the first method mentioned in the first post? Thanks for all the
help!