Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Button- Hyperlink- please help? | New Users to Excel | |||
Intra-workbook hyperlink: macro/function to return to hyperlink ce | Excel Discussion (Misc queries) | |||
Macro to Copy Hyperlink to another file as a HYPERLINK, not text... | Excel Programming | |||
hyperlink to a button | Excel Programming | |||
Pause macro, add form button to sheet, continue macro when button clicked! | Excel Programming |