Solved

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

Posted on 2014-09-23
11
300 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
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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
macro for active word document 4 39
Excel partial font macro 14 26
highlight duplicate entry 16 29
FormulaArray VBA Issue 6 17
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
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 demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

912 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

20 Experts available now in Live!

Get 1:1 Help Now