Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
Sorry to repost but my earlier post posted thru excelforums did not appeared on this news group. I am new here but would like to post one problem. I have developed a application that uses IE for querrying data from our intranet servers(majority code was picked up from this NG and tweeked to my requirement) I have noticed that the application always opens a new instance of the IE. I tried all the solutions available on this NG but no joy. If IE is open, I would like to use the same for my application. Do I need any referance missing? Code below gives me runtime error 429 "Activex componant can't create object" If I comment out the on error resume next statement, code always create new instance of IE even if IE is already running. Please guide me. Jagruti Here is my code : Sub detect_IE() Dim mybrowser As Object On Error Resume Next Set mybrowser = GetObject(, "InternetExplorer.Application") If Err.Number = 429 Then Set mybrowser = CreateObject ("Internetexplorer.application") mybrowser.Visible = True Err.Clear End If With mybrowser ..navigate "http://www.google.com" End With On Error GoTo 0 End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jagruti
Copy this in a normal module Private Declare Function GetDesktopWindow Lib "user32" () As Long 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 Public Sub RunShellExecute(ByVal sFile As Variant) Dim hWndDesk As Long Dim success As Long Const SE_ERR_NOASSOC = &H31 hWndDesk = GetDesktopWindow() success = ShellExecute(hWndDesk, "Open", sFile, 0&, 0&, 3) End Sub Sub Run1() RunShellExecute "http://www.google.com" End Sub Sub Run2() RunShellExecute "http://www.msn.com" End Sub Sub Run3() RunShellExecute "http://www.nu.nl" End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Jagruti" wrote in message ... Hi all, Sorry to repost but my earlier post posted thru excelforums did not appeared on this news group. I am new here but would like to post one problem. I have developed a application that uses IE for querrying data from our intranet servers(majority code was picked up from this NG and tweeked to my requirement) I have noticed that the application always opens a new instance of the IE. I tried all the solutions available on this NG but no joy. If IE is open, I would like to use the same for my application. Do I need any referance missing? Code below gives me runtime error 429 "Activex componant can't create object" If I comment out the on error resume next statement, code always create new instance of IE even if IE is already running. Please guide me. Jagruti Here is my code : Sub detect_IE() Dim mybrowser As Object On Error Resume Next Set mybrowser = GetObject(, "InternetExplorer.Application") If Err.Number = 429 Then Set mybrowser = CreateObject ("Internetexplorer.application") mybrowser.Visible = True Err.Clear End If With mybrowser .navigate "http://www.google.com" End With On Error GoTo 0 End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ambiguous name detected? | Excel Discussion (Misc queries) | |||
errors detected in by excel | New Users to Excel | |||
ambiguous name detected | Excel Programming | |||
Ambiguous Name Detected | Excel Programming | |||
Ambiguous Name Detected:~ | Excel Programming |