Question Shell working for 32 BIT Not for 64 BIT (1 Viewer)

antonio.manoj.derose

Registered User.
Local time
Today, 23:47
Joined
Jul 4, 2013
Messages
62
Hi All,

Good morning to everyone, I am here to post an issue which I worked a bit and killed a time in trying solving the problem, yet have no joy till now.

I am trying to work on with my tool, which is the launcher for the main application, have got 2 main applications, one for 32 and the other for 64.

Question / Suggestion

Note : Launcher is MS access application VBA - 2 separate code set projects for 32 BIT and 64 BIT
Note : Main application MS access application VBA - 2 separate code set projects for 32 BIT and 64 BIT

1) The launcher is an application where, double clicking will open up the main application, it does work nicely for x32 but not for the x64

2) Is there a way of making the launcher application a universal one, so that I maintain only one version of launcher.
e.g : one project for launcher 32 BIT and 64 BIT

3) Described below is the code for the launcher, my concern below is with the code that I have mentioned in green font does not seem like triggering.

4) Much appreciated, your thoughts, please shoot in your comments.

Option Compare Database

Function nilAutoexec()

Dim strCommandLine As String

Call strAdpPath

If Dir("C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE") <> "" Then
strCommandLine = Chr$(34) & "C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE" & Chr$(34) & " " & Chr$(34) & strAdpPath & Chr$(34) & " /runtime"
End If

Shell strCommandLine, vbMaximizedFocus

End Function

Function strAdpPath()
If Dir$("C:\Main\x32_Dealer_Rec_Tool.accde") <> "" Then
strAdpPath = "C:\Main\x32_Dealer_Rec_Tool.accde"
End If
End Function

Thanks,

Antonio Manoj
 

GinaWhipp

AWF VIP
Local time
Today, 09:47
Joined
Jun 21, 2011
Messages
5,899
Hmm, you probably want to test which version of Windows and then choose which line(s) to run. So, you could check for this folder...

Code:
C:\Program Files (x86)\

However, I still see a problem for example, as I have several versions of Office installed, so my path would not be the generic one. Checking for Access in the Default path could still lead to issues.
 

antonio.manoj.derose

Registered User.
Local time
Today, 23:47
Joined
Jul 4, 2013
Messages
62
Hi Gina,

As I mentioned the version of windows that I want to check in is the windows 7 64 BIT, MS Office Access 2013 64 BIT.

What you have mentioned is not being the case, as I am checking for the 64 BIT, and in the meantime, nevertheless gave a try with yours, does not come, technically it should not, as I cant look for 64 BIT application under a 32 BIT folder C:\Program Files (x86)\

I understand that I have made confused with the above mentioned code provided, hence please see the code that I have provided below.

Any thoughts, most welcome.

Option Compare Database

Function nilAutoexec()

Dim strCommandLine As String

Call strAdpPath

If Dir("C:\Program Files\Microsoft Office\OFFICE15\MSACCESS.EXE") <> "" Then
strCommandLine = Chr$(34) & "C:\Program Files\Microsoft Office\OFFICE15\MSACCESS.EXE" & Chr$(34) & " " & Chr$(34) & strAdpPath & Chr$(34) & " /runtime"
End If

Shell strCommandLine, vbMaximizedFocus

End Function

Function strAdpPath()
If Dir$("C:\Main\x64_Dealer_Rec_Tool.accde") <> "" Then
strAdpPath = "C:\Main\x64_Dealer_Rec_Tool.accde"
End If
End Function

Thanks,

Antonio Manoj
 

GinaWhipp

AWF VIP
Local time
Today, 09:47
Joined
Jun 21, 2011
Messages
5,899
Oops, I misread, try checking the Registry. I found this...

If HKLM\Software\WOW6432Node exists then Windows is 64-bit.
If HKLM\Software\WOW6432Node\Microsoft\Office exists, then Office is 32-bit.
If HKLM\Software\WOW6432Node\Microsoft\Office does not exist, but HKLM\Software\Microsoft\Office does exist, then Office is 64-bit.
If HKLM\Software\WOW6432Node does not exist, then Windows and Office are 32-bit.

from http://stackoverflow.com/questions/...ffice-2010-is-32bit-or-64bit-via-the-registry
 

vbaInet

AWF VIP
Local time
Today, 14:47
Joined
Jan 22, 2010
Messages
26,374
For me the first thing I will check is if Shell is actually returning a process ID?
 

antonio.manoj.derose

Registered User.
Local time
Today, 23:47
Joined
Jul 4, 2013
Messages
62
Hi Gina,

Very wise information, valuable information, now I get the point that even after installing the windows 32 BIT, there is a way of finding it, whether you could do a install of 64 BIT, provided you format it, by going through the regedit.

However this is not what I currently want at the moment, instead I want to check whether am able to find out, why the shell command is breaking at the time of triggering that very code which is below (Maroon font), it is mentioning check in for online solutions, when it is triggering that point.

Shell strCommandLine, vbMaximizedFocus

Hi VbaInet,

Could you please tell me, how would I do, Process id, and what is the point of doing so.

Your thoughts and suggestions, please shoot in.

Thanks,

Antonio Manoj
 

vbaInet

AWF VIP
Local time
Today, 14:47
Joined
Jan 22, 2010
Messages
26,374
You can use an MsgBox (for example):
Code:
MsgBox Shell(strCommandLine, vbMaximizedFocus)
Shell returns a Process ID if successful. If this doesn't return a Process ID then you can also test strCommandLine in command prompt itself.
 

antonio.manoj.derose

Registered User.
Local time
Today, 23:47
Joined
Jul 4, 2013
Messages
62
Hi vba,

It returns a process id I guess, I tried twice the times in running the code, and both the times it returned with some numbers under the message boxes.

First time it was 1516, and the second time it was 536.

However, both the times, before popping up with the messages, it gave the same problem as earlier, not working.

Should there be a different type of shell code, to be placed for the 64 BIT applications, compared to the 32 BIT.

Though the message box appear, the code does not execute as expected.

By the way, could you please tell me, how do I test this in the command prompt, as you have instructed me.

Thanks,

Antonio Manoj
 

antonio.manoj.derose

Registered User.
Local time
Today, 23:47
Joined
Jul 4, 2013
Messages
62
Hi Gina,

The Ptrsafe, does not seem like working, the MSDN came in handy for my future reference, not at this moment.

Please shoot in your findings.

Thanks,

Antonio
 

vbaInet

AWF VIP
Local time
Today, 14:47
Joined
Jan 22, 2010
Messages
26,374
By the way, could you please tell me, how do I test this in the command prompt, as you have instructed me.
Debug.Print the strCommand, copy and paste the resulting string and run it in command prompt directly.

And also try this:
Code:
MsgBox Shell("cmd /k " & strCommandLine, vbMaximizedFocus)

Let's also get you trying another approach:
Code:
    Dim objShell As Object
    
    Set objShell = CreateObject("Shell.Application")
    
    objShell.ShellExecute Chr$(34) & strAdpPath & Chr$(34), _
                          "/runtime", _
                          Chr$(34) & "C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE" & Chr$(34), _
                          "open"
...so that's 3 things you should try so please try all three before posting.
 

antonio.manoj.derose

Registered User.
Local time
Today, 23:47
Joined
Jul 4, 2013
Messages
62
Hi VbaInet,

The message box works for the beside mentioned, MsgBox Shell("cmd /k " & strCommandLine, vbMaximizedFocus), but not for the below

MsgBox Shell("cmd /k " & strCommandLine, vbMaximizedFocus), when I put In the code, it is giving an error for the second parameter, which is vbMaximizedFocus asking for an = sign, I guess.

The below what you have given does result the same

Dim objShell As Object

Set objShell = CreateObject("Shell.Application")

objShell.ShellExecute Chr$(34) & strAdpPath & Chr$(34), _
"/runtime", _
Chr$(34) & "C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE" & Chr$(34), _
"open"
Guys, I forgot to mention, that I am using a VMware for the x64 application that I have developed. Maybe that is why it is not working, I do not have a dedicated workstation, for me to check the capability / behaviour of the code to action.

Sorry for not letting you know at the start.

Small help - Could you tell me, how would you post / reply back, in a screen shot format, just as the way VbaInet had done it, will be really handy, If I knew it. with the scroll bars.

Thanks,

Antonio
 

vbaInet

AWF VIP
Local time
Today, 14:47
Joined
Jan 22, 2010
Messages
26,374
The message box works for the beside mentioned, MsgBox Shell("cmd /k " & strCommandLine, vbMaximizedFocus), but not for the below

MsgBox Shell("cmd /k " & strCommandLine, vbMaximizedFocus), when I put In the code, it is giving an error for the second parameter, which is vbMaximizedFocus asking for an = sign, I guess.

The below what you have given does result the same
Anotnio I don't understand what you said above. You need to tell us what exactly the error message is and when you same the result, what result are you referring to? Basically, we can't see what you're doing so please be more explicit in your descriptions.

As for the VMWare that could be an issue. What I was asking you to try is open command prompt and run the code directly from command prompt.
 

Users who are viewing this thread

Top Bottom