Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Button with hyperlink and asigne macro

The macro below enters date/time in col A and then selects col B ready for
me to enter the result of a broadband speed test. The macro has been asigned
to a button on the sheet.
The URL for the broadband test is
http://www.broadbandwatchdog.co.uk/speed-test.php

If the button is hyperlinked to the URL the broadband test is run but the
macro is not.
Can you show me how to incorporate the URL in the macro so both bradband
test is run and the date time entered?

Thank you

Francis Hookham

PS - do tidy the macro - I am sure mine is a bit crude!

Sub Macro1()
Application.ScreenUpdating = False
x = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(x, 1).FormulaR1C1 = "=NOW()"
Cells(x, 1).Copy
Cells(x, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Cells(x, 2).Select
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Button with hyperlink and asigne macro

On Nov 6, 3:23 pm, "Francis Hookham" wrote:
The macro below enters date/time in col A and then selects col B ready for
me to enter the result of a broadband speed test. The macro has been asigned
to a button on the sheet.
The URL for the broadband test ishttp://www.broadbandwatchdog.co.uk/speed-test.php

If the button is hyperlinked to the URL the broadband test is run but the
macro is not.
Can you show me how to incorporate the URL in the macro so both bradband
test is run and the date time entered?

Thank you

Francis Hookham

PS - do tidy the macro - I am sure mine is a bit crude!

Sub Macro1()
Application.ScreenUpdating = False
x = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(x, 1).FormulaR1C1 = "=NOW()"
Cells(x, 1).Copy
Cells(x, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Cells(x, 2).Select
End Sub


Hello Francis,

Copy the following code into a standard VBA module. Attach the macro
"GoToSite" to your button.

'<<<Start of Macro code
' This will Launch the default Email program
Private Declare Function ShellExecute _
Lib "Shell32.dll" _
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 GoToSite()

Dim RetVal
Dim URL As String

URL = "http://www.broadbandwatchdog.co.uk.com/speed-test.php"
RetVal = ShellExecute(0&, "open", URL, vbNullString,
vbNullString, vbNormalFocus)

'Did Connection Fail? Errors are from 0 to 32
If RetVal <= 32 Then
Select Case RetVal
Case 2 'SE_ERR_FNF
Msg = "File not found"
Case 3 'SE_ERR_PNF
Msg = "Path not found"
Case 5 'SE_ERR_ACCESSDENIED
Msg = "Access denied"
Case 8 'SE_ERR_OOM
Msg = "Out of memory"
Case 32 'SE_ERR_DLLNOTFOUND
Msg = "DLL not found"
Case 26 'SE_ERR_SHARE
Msg = "A sharing violation occurred"
Case 27 'SE_ERR_ASSOCINCOMPLETE
Msg = "Incomplete or invalid file association"
Case 28 'SE_ERR_DDETIMEOUT
Msg = "DDE Time out"
Case 29 'SE_ERR_DDEFAIL
Msg = "DDE transaction failed"
Case 30 'SE_ERR_DDEBUSY
Msg = "DDE busy"
Case 31 'SE_ERR_NOASSOC
Msg = "Default Email not configured"
Case 11 'ERROR_BAD_FORMAT
Msg = "Invalid EXE file or error in EXE image"
Case Else
Msg = "Unknown error"
End Select
MsgBox "Error - " & Msg & vbCrLf & URL
End If

End Sub
'End of Macro Code<<<

Sincerely,
Leith Ross

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default Button with hyperlink and asigne macro

Wow! That's dipping my toe into waters I never dreamt of.

Thanks very much Leith - it will be very useful to know how to do this in
the future as well as with this particular prob.

Best wishes

Francis



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Button- Hyperlink- please help? Anand vijay New Users to Excel 2 January 15th 07 10:13 PM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM
Macro to Copy Hyperlink to another file as a HYPERLINK, not text... dollardoc Excel Programming 1 April 7th 05 12:47 AM
hyperlink to a button scrabtree23[_3_] Excel Programming 1 February 10th 05 03:43 PM
Pause macro, add form button to sheet, continue macro when button clicked! Flystar[_15_] Excel Programming 1 May 26th 04 09:45 AM


All times are GMT +1. The time now is 02:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"