Solved

the code in this project must be updated for use on 64-bit systems

Posted on 2014-09-23
11
321 Views
Last Modified: 2014-09-30
I need someone to help me rewrite the code below as insstructed in the google search results for this issue

https://www.google.com/search?q=the+code+in+this+project+must+be+updated+for+use+on+64-bit+systems&oq=the+code+in+this+project+must+be+updated+for+use+on+64-bit+systems&aqs=chrome..69i57j0l5.728j0j9&sourceid=chrome&es_sm=0&ie=UTF-8

offending code

Option Explicit

' ----------------------------------------------------------------------------

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
Private Function blnShell_Execute(ByVal strURL As String, _
Optional ByVal strParameters As String = vbNullString, _
Optional lngShow_Cmd As Long = vbNormalFocus) As Boolean

Dim blnReturn As Boolean
Dim lngHandle As Long

On Error GoTo Err_blnShell_Execute

blnReturn = False

lngHandle = ShellExecute(0&, vbNullString, strURL, strParameters, vbNullString, lngShow_Cmd)

blnReturn = (lngHandle > 31)

Exit_blnShell_Execute:

On Error Resume Next

blnShell_Execute = blnReturn

Exit Function

Err_blnShell_Execute:

blnReturn = False

Resume Exit_blnShell_Execute

End Function




Public Sub Open_Google_Searches()

  Dim objCell                                           As Range
 
  For Each objCell In [A1:A5]
 
      DoEvents
     
      If Not IsEmpty(objCell) Then
         If Not (blnShell_Execute("http://www.google.com/search?hl=en&q=%22" & objCell & "%22")) Then
            MsgBox "Could not launch:" & vbCrLf & vbLf & objCell, _
                    vbExclamation Or vbOKOnly, _
                    ActiveWorkbook.Name
         End If
      End If
     
  Next objCell
               
End Sub

' ...End of Code
0
Comment
Question by:finnstone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 400 total points
ID: 40339152
That code looks familiar (i.e. it was originally written by me).

Where did you source it from, finnstone?

I would like to help (again), if I can, but if you have a link to the original question it will help me check that any changes do not impact the original functionality.

Fundamentally, the "ShellExecute" function needs to be changed from:

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

to:

Private 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
0
 
LVL 85

Assisted Solution

by:Rory Archibald
Rory Archibald earned 100 total points
ID: 40339161
(NFP)

You'll also need to change:
Dim lngHandle As Long

Open in new window

to:
Dim lngHandle As LongPtr

Open in new window

as a result.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 40339167
Thanks Rory.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:finnstone
ID: 40339175
yes a LONG time ago. good to see you again!

thanks
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 40339178
:)
0
 

Author Comment

by:finnstone
ID: 40339200
ive run your script at least 10k times
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 40339224
I noticed you have left it as originally formatted, even though you sought some amendments in this question:

"need to add some code to skip every other row in excel vba macro"

Glad to read it is still useful to you.
0
 

Author Comment

by:finnstone
ID: 40339237
I have many variants of it now :)
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 40339272
I guess I should have spelled out the NFP... ;)
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 40339390
No problem, Rory; it was valuable input.
0
 

Author Comment

by:finnstone
ID: 40353760
got a new one for you fanpages!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question