Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Possible to run command prompt code within Access 2010?

41 views
Skip to first unread message

PW

unread,
Feb 10, 2012, 1:18:25 PM2/10/12
to
Hi,

We use a third party Active X control for our calendars. Right now we
have the user bring up the command prompt and register it manually.

Can we do this in VBA instead so we can put it on a form or ribbon?

The user first browses to the folder that contains the control
("ourapp\bin") then types in "regsvr32.exe controlname.ocx".

-paulw

PW

unread,
Feb 10, 2012, 5:52:30 PM2/10/12
to
I also would like to know how to get rid of the File tab. When I
created an MDE the tab is still there. I do not want to distribute
our application with the File tab appearing.

-pw

Patrick Finucane

unread,
Feb 11, 2012, 5:21:28 PM2/11/12
to

PW

unread,
Feb 12, 2012, 12:17:19 PM2/12/12
to
I don't think so Patrick. Maybe I am not getting it!

-paul

Phil

unread,
Feb 12, 2012, 4:09:50 PM2/12/12
to
Idle thought
Can you create a batch file to do what you wanr and then use the ShellWait
function to run the batch file

'This code was originally written by Terry Kreft.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Terry Kreft
Private Const STARTF_USESHOWWINDOW& = &H1
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&

Private Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type

Private Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type

Private Declare PtrSafe Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long

Private Declare PtrSafe Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long

Private Declare PtrSafe Function CloseHandle Lib "kernel32" (ByVal _
hObject As Long) As Long

Public Function ShellWait(PathName As String, Optional WindowStyle As Long)
As Integer 'ShellWait ("C:\Program Files\ZipGenius 6\ZG.Exe -add " &
"""C:\Documents and Settings\Phil\My Documents\Access\MDB\WFYC\WFYCTab2007 02
September 2008 09 49.zip""" & " C5 +" & """C:\Documents and Settings\Phil\My
Documents\Access\MDB\WFYC \WFYCTab2007.mdb""")

Dim proc As PROCESS_INFORMATION
Dim Start As STARTUPINFO
Dim ret As Long

' Initialize the STARTUPINFO structure:
With Start
.cb = Len(Start)
If Not IsMissing(WindowStyle) Then
.dwFlags = STARTF_USESHOWWINDOW
.wShowWindow = WindowStyle
End If
End With
' Start the shelled application:
ret& = CreateProcessA(0&, PathName, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, Start, proc)
' Wait for the shelled application to finish:
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)

ShellWait = ret ' 1 for OK, 0 for failes

End Function

Phil

PW

unread,
Feb 13, 2012, 2:52:58 PM2/13/12
to
On Sun, 12 Feb 2012 21:09:50 GMT, "Phil" <ph...@stantonfamily.co.uk>
wrote:

>On 12/02/2012 17:17:22, PW wrote:
>> On Sat, 11 Feb 2012 14:21:28 -0800 (PST), Patrick Finucane
>> <patrickf...@gmail.com> wrote:
>>
>>>On Feb 10, 12:18 pm, PW <emailaddyin...@ifIremember.com> wrote:
>>>> Hi,
>>>>
>>>> We use a third party Active X control for our calendars.  Right now we
>>>> have the user bring up the command prompt and register it manually.
>>>>
>>>> Can we do this in VBA instead so we can put it on a form or ribbon?
>>>>
>>>> The user first browses to the folder that contains the control
>>>> ("ourapp\bin") then types in "regsvr32.exe controlname.ocx".
>>>>
>>>> -paulw
>>>
>>>Would this be an option?
>>>http://access.mvps.org/access/api/api0019.htm
>> I don't think so Patrick. Maybe I am not getting it!
>>
>> -paul
>>
>
>Idle thought
>Can you create a batch file to do what you wanr and then use the ShellWait
>function to run the batch file
>

I've never tried that before Phil. Thanks.
0 new messages