Solved

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

Posted on 2014-09-23
11
290 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
  • 5
  • 4
  • 2
11 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 400 total points
Comment Utility
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
Comment Utility
(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 ]
Comment Utility
Thanks Rory.
0
 

Author Closing Comment

by:finnstone
Comment Utility
yes a LONG time ago. good to see you again!

thanks
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
:)
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:finnstone
Comment Utility
ive run your script at least 10k times
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
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
Comment Utility
I have many variants of it now :)
0
 
LVL 85

Expert Comment

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

Expert Comment

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

Author Comment

by:finnstone
Comment Utility
got a new one for you fanpages!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now