Announcement

Collapse
No announcement yet.

Maximizing 2 or more IE windows in VBA

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maximizing 2 or more IE windows in VBA



    I posted an answer on Maximizing IE window in VBA, on OzGrid. However when I tried to use the same code where I had 2 IE addresses, it give a variable not defined error on this line:
    Code:
     MyValue = Application.InputBox("Only Click Ok or Cancel after your  Selection!!!!!!!" & vbCrLf & _
                           "1 = OVR Office Directory" & vbCrLf & _
                           "2 = BBVS (Bureau of Blindness & Visual Services)    Office Directory", "Vocational Services - OVR   " & ActiveSheet.Name)
    I am trying to understand why it is giving the error when there are 2 or more addresses, & not on a singe address. Here is the entire code:
    Code:
    Sub OVR_Office_Listing()
          Dim i As String
         'MsgBox prompt:="1st 6 Months of Reports?", Title:="Referral Workbook - Data  Entry"
         i = MsgBox("Continue to OVR Directories?", vbYesNo, "Vocational Services - OVR   " & ActiveSheet.Name)
         If Not i = vbYes Then Exit Sub
    
       'First message shows in the body of the box, message 2 shows at the top of the box.
       Do
       MyValue = Application.InputBox("Only Click Ok or Cancel after your  Selection!!!!!!!" & vbCrLf & _
                           "1 = OVR Office Directory" & vbCrLf & _
                           "2 = BBVS (Bureau of Blindness & Visual Services)    Office Directory", "Vocational Services - OVR   " & ActiveSheet.Name)
     'Sub messaage box exit.
     If MyValue = False Then
        Exit Sub
     ElseIf (MyValue = 1) Or (MyValue = 2) Then
        Exit Do
     Else
     MsgBox "You have not made a valid entry.  Please try again.", vbInformation, "Vocational Services - OVR   " & ActiveSheet.Name
     End If
    
     Loop
    'Code to Execute When Condition = value_1
    Select Case MyValue
     Case 1
    'Message prior to calling the webb address.
    MsgBox "Please wait, while I get you the OVR web address.", vbInformation, "Vocational Services - OVR   " & ActiveSheet.Name
    Dim ie As Object
    Set ie1 = CreateObject("INTERNETEXPLORER.APPLICATION")
    ie1.NAVIGATE "http://www.dli.pa.gov/individuals/disability-services/ovr/pages/OVR-office-directory.aspx"
    ie1.Visible = True
    apiIEsize ie.hwnd, 3
     'Code to Execute When Condition = value_2
    Select Case MyValue
    End Select
     Case 2
    'Message prior to calling the webb address.
    MsgBox "Please wait, while I get you the Bureau of Blindness & Visual Services Office Directory!", vbInformation, "Vocational Services - OVR   " & ActiveSheet.Name
    Dim ie2 As Object
    Set ie2 = CreateObject("INTERNETEXPLORER.APPLICATION")
    ie2.NAVIGATE "http://www.dli.pa.gov/Individuals/Disability-Services/bbvs/Pages/BBVS-Office-Directory.aspx"
    ie2.Visible = True
    apiIEsize ie.hwnd, 3
    End Select
    End Sub
    Please show me what I am doing wrong & how to correct it.

  • #2


    Problem solved. I broke the 2 IE addresses down to 2 separate addresses & called them. For example I changed
    Code:
     
     Case 1 'Message prior to calling the webb address. MsgBox "Please wait, while I get you the OVR web address.", vbInformation, "Vocational Services - OVR   " & ActiveSheet.Name Dim ie As Object Set ie1 = CreateObject("INTERNETEXPLORER.APPLICATION") ie1.NAVIGATE "http://www.dli.pa.gov/individuals/disability-services/ovr/pages/OVR-office-directory.aspx" ie1.Visible = True apiIEsize ie.hwnd, 3
    to
    Call Career_link

    Here is the new code:
    Code:
     
     MsgBox "Please wait, while I get you the OVR web address.", vbInformation, "Vocational Services - OVR   " & ActiveSheet.Name Dim ie As Object Set ie = CreateObject("INTERNETEXPLORER.APPLICATION") ie1.NAVIGATE "http://www.dli.pa.gov/individuals/disability-services/ovr/pages/OVR-office-directory.aspx" ie1.Visible = True apiIEsize ie.hwnd, 3

    Comment

    Working...
    X