'Alan dot Kaplan at va dot gov 9/12/2013 'takes a URL in clipboard, removes whitespace, then 'launches in default browser. 'This is whacking a small problem with a lot of code. 'Based on Ed Wilson's orignal script: 'http://blogs.technet.com/b/heyscriptingguy/archive/2004/12/15/how-can-i-grab-a-url-from-the-clipboard-and-then-open-that-web-site-in-a-browser.aspx? 'Some code lifted from 'http://community.spiceworks.com/topic/133430-find-default-browser Option Explicit dim wshShell:Set wshShell = WScript.CreateObject("WScript.Shell") Dim objIE:Set objIE = CreateObject("InternetExplorer.Application") Dim strBrowser, StrMessage,strURL 'Read default browser Const strDefBrowserKey = "HKCR\http\shell\open\ddeexec\Application\" 'Thanks to Ed and Jason Const Win8BrowserKey = "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice\ProgId" On Error Resume Next 'This is much faster than testing for OS version. strBrowser = wshShell.RegRead(Win8BrowserKey) If Err <> 0 Then Err.Clear strBrowser = wshShell.RegRead(strDefBrowserKey) End If strBrowser = left(strBrowser,2) Dim objWord, bWord bWord = False 'try to use Word Clipboard, which can be accessed silently 'I don't remember where this was copied from ... Set objWord = CreateObject("Word.Application") If Err.Number = 0 Then bWord = True objword.visible=False With objWord .Documents.add .Selection.Paste .Selection.WholeStory strURL= .Selection End With objWord.quit False Set objWord = Nothing Else 'Word not available, use IE object, which prompts on access Err.Clear 'build the message saying why they get a warning StrMessage = "his retrieves the URL from your clipboard using the Internet Explorer, please press 'Allow' at prompt" If strBrowser = "IE" Then StrMessage = "T" & strMessage Else StrMessage = "Even though it is not your default browser, t" & strMessage End If wshShell.Popup strmessage,3,"Allow IE Access" objIE.Navigate("about:blank") strURL = objIE.document.parentwindow.clipboardData.GetData("text") End If 'See function for remarks strURL = CleanUrl(strURL) 'We already have IE object. If IE is the default, use it to open web page If strBrowser = "IExplore" Then objIE.Visible = True objIE.Navigate(strURL) Else 'You have some other default browser, quit IE '(you can do this even if you never used the object) objIE.Quit 'Open URL with default browser wshShell.Run(strURL) End If Set objIE = Nothing Function CleanUrl(strTxt) 'Remove all sorts of non URL characters Dim tArray, i tArray = Array(VbCrLf,Space(1),">",vbCr,VbLf) For i = 0 To UBound(tArray) strTxt = Replace(strTxt,tArray(i),"") Next 'You can't launch a URL with RUN without HTTP:// If InStr(strTxt,"//") = 0 Then strTXT = "http://" & strTxt End If CleanUrl = strTxt End Function