Solved

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

Posted on 2014-09-23
11
315 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
Industry Leaders: 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

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!

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

737 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