Hi All,
I want to facilitate some task at my work and i want to use below code, though i have an issue with it. For testing i used gmail registration page. On my PC at home macro works, it fills input box with value from excel cell. But at my workplace same code doesn't work. There is Error 91 (Object variable or With block variable not set) - from what i have learnt it indicates that VBA couldn't find requested object. I tried to search web about it and only explanation i found was that page may not be loaded completely, but the macro works on already loaded page. Is it possible then that IE at my work is somehow protected and VBA is unable to retrieve elements from it?
Here's the code i use (i found it on web):
Sub GetIE()
Dim shellWins As ShellWindows
Dim IE As InternetExplorer
Set shellWins = New ShellWindows
If shellWins.Count > 0 Then
' Get IE
Set IE = shellWins.Item(0)
Else
' Create IE
Set IE = New InternetExplorer
IE.Visible = True
End If
entryV = Range("a1")
Set UserN = IE.Document.getElementsByName("FirstName")
If Not UserN Is Nothing Then
UserN(0).Value = entryV
End If
Set IE = Nothing
Set shellWins = Nothing
End Sub
Thank you in advance.











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks