![]() |
|
#1
|
|||
|
|||
|
Hi all,
I'm having a problem. I would like a macro to open a browser window to Google, even when there is no document open. I can do it with a document open using ActiveDocument.FollowHyperlink ("https://www.google.ca/?gws_rd=ssl"). But obviously that's using a property of the ActiveDocument. How do I open this link when there is no ActiveDocument? Thanks! |
|
#2
|
|||
|
|||
|
Code:
Option Explicit
#If VBA7 Then
Public Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As LongPtr, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As LongPtr
#Else
Public 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
#End If
Public Sub NewShell(cmdLine As String)
ShellExecute 1, "open", cmdLine, "", "", 1
lbl_Exit:
Exit Sub
End Sub
Sub Test()
NewShell "www.google.com"
End Sub
|
|
| Tags |
| links, macro, vba |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Cannot open DOC email attachment will only save as DOCx which I also cannot open
|
Batty | Word | 8 | 08-01-2014 03:24 AM |
Formula to open external file with specific program (like open with)
|
pemartins | Excel | 16 | 02-24-2014 11:39 PM |
Run-time error '1004': Document not saved. The document may be open...
|
doctor_who12 | Excel Programming | 1 | 01-22-2014 04:47 PM |
| macro to open another document | coconutt | Word VBA | 1 | 06-11-2012 04:39 AM |
| Word 2003 .doc: open website .doc link inside of browser window | SunnyOz | Word | 0 | 08-16-2010 01:23 AM |