Map is not working as expected in win11 by pushing code through vba

vipulgos

Active Member
Joined
Aug 17, 2002
Messages
335
Office Version
  1. 2010
Platform
  1. Windows
Hi

I am using this VBA successfully in Win10, Office 2010.

This link allows me to go to Firefox and open the links directly from VBA

But after changing my pc with Win11, Office2010 this is not working. sURL3 is working properly, but the sURL2 part, which is expected to open the location of the particular building under some village and some province (taluka) is not working.
No doubt it tries to open (I can see the expected url text in browser, but map coming back to my present location

Please guide me. Following is the essential part of code:

VBA Code:
Dim spath As String
Dim spath1 As String
Dim sURL As String
Dim sURL1 As String
Dim sURL2 As String
Dim sURL3 As String
Dim newvil
Dim dTaskID As Double

On Error GoTo 2:
spath = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" 'my browser

sURL2 = Replace(Range("buildname2").Value, " ", "+") & "+" & newvil & "+" & Range("taluka")

newvil = IIf(InStr(Range("village"), " "), Replace(Range("village"), " ", "+"), Range("village"))

sURL3 = Replace(Range("buildname3").Value, " ", "+") & "+" & newvil & "+" & Range("taluka") & "+Flat+sale"


dTaskID = Shell(spath & " " & sURL2 & " -new-tab " & sURL3, vbNormalFocus)
Exit Sub
2:
spath1 = "C:\Program Files\Mozilla Firefox\firefox.exe" 'my browser
sURL2 = Replace(Range("buildname2").Value, " ", "+") & "+" & newvil & "+" & Range("taluka")
sURL3 = Replace(Range("buildname3").Value, " ", "+") & "+" & newvil & "+" & Range("taluka") & "+Flat+sale"


dTaskID = Shell(spath1 & " " & sURL2 & " -new-tab " & sURL3, vbNormalFocus)

End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,215,072
Messages
6,122,966
Members
449,094
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top