Shell Command..sychronous/Asynchronous

Oct 4, 2006

Hi everyone

I searched the forum for help..but couldnt find what I am looking for.

I want to run a batch file using shell cmd and wait for it to complete..until then I want to display a hourglass...because my next line of code needs the batch file run completed.

Right now, shell command starts the batch file then continutes to the next line of code..Tried the Doevents does not work right.

Access help states that :
"By default, the Shell function runs other programs asynchronously. "

How can I make it synchronous?



Thanks in advance for the help.

View Replies


ADVERTISEMENT

Modules & VBA :: SHELL Command Always Opens The Folder Minimized

Sep 30, 2013

I'm trying to use this command:

Code:
Shell "C:WINDOWSexplorer.exe """ & Me.txtSource & """, VbMaximizedFocus"

to open a folder from within Access 2007 & Windows7. It works, but it always opens the folder minimised, whether I use VbMaximizedFocus or VbNormalFocus. It used to work properly in Access 2003 & WinXP.

View 2 Replies View Related

Modules & VBA :: Shell Command Not Working With Spaces In File Name

Oct 21, 2013

I am in trouble with the shell ocmmand,i have a text box "ExcelPath Location" in which there is a path of excel file i am using below code to open the excel file but it gives an error:

Code:

Private Sub Command11_Click()
Dim str As String
str = ExcelPathLocation.Value
strPath = Dir(str)
Shell "excel.exe" & """" & strPath & """", vbNormalFocus
End Sub

the value of text box is

O:QA FilesQC ReportingPending ReviewB329129)419479_BoxPort_RAMANDEEP BRAR_(10192013.xlsm

it gives run time error : 53 file not found.

View 3 Replies View Related

Modules & VBA :: Shell Picture Viewer Command Opens Minimized?

Aug 13, 2015

I'm having trouble with a shell() command in my vba.

I'm trying to call up the picture viewer showing the file of the photo I clicked on in a form. Everything is happening as expected - the file opens in Windows Photo Viewer, but it is minimized.

I can open a picture fine from Windows Explorer, but something about my shell command is forcing a minimize.

Here is my code:

Code:
Dim sFile As String
PicFile = "C:Pics" & Me!PicName & ".jpg"
Shell "RunDLL32.exe C:WindowsSystem32Shimgvw.dll,ImageView_Fullscreen " & PicFile

I would have assumed ImageView_Fullscreen would do what I want!

View 4 Replies View Related

Modules & VBA :: Invalid Procedure Call Or Argument Using Shell Command?

Feb 6, 2015

I'm developing an application where I want to call the keyboard up on the screen when a user enters a field. This is my setup:

Windows 8.1 32 Bit, Access Runtime 2010.
Exact lines of code are:

Dim RetVal
RetVal = Shell("C:Program FilesCommon Filesmicrosoft sharedinkTabTip.exe")

These lines of code work perfectly fine on my development PC which is running Windows 7 64 bit, Access/Office 32 bit.

I know the path to the exe is good. I can navigate and double click it and it works great. but the shell command is resulting in the invalid procedure.

View 4 Replies View Related

Shell()

Feb 10, 2006

Hello all,

I use Shell() to open an external program - this works absolutely fine on Windows XP - but I believe it is causing a problem on 2000.

I am using the following code:
Shell """C:Program FilesLindenhouse Software LtdInvuFirstInvuFirst"" FirstOffice C:illingtemp.xls", vbNormalFocus

I get an invalid procedure call on the 2000 machine?

Any ideas?

View 2 Replies View Related

Shell() Help?

May 17, 2006

Ok, this is very odd. I am running a small DOS executable from within a db. I am using the shell command. The DOS exe is suppose to create a *.txt file. The file creates the *.txt file if I launch it from Windows Explorer. Howeve, if I use the Shell() command, it does not create the *.txt file. What can I use in place of the Shell() command to execute the file as if it was being executed from within Windows Explorer. I don't understand why it isn't working with the Shell() command...

View 14 Replies View Related

Shell Object Rename Help

Jan 24, 2007

Hi~
First off, sorry about the title; I couldn't really come up with anything that made sense.

Here's what I'm trying to do, I am trying to rename a table in one database from within another (there is a really good reason why I want to do it from somewhere other than the db that contains the object). Here is what I have so far in my code:


Private Sub cmdTest_Click()

Dim strSource As String 'the db that contains the table I want to rename

strSource = Application.CurrentProject.Path & " est1.mdb"

'Shell the file
Shell "C:Program FilesMicrosoft OfficeOFFICE11msaccess.exe """ & strSource & "", vbNormalFocus

'Acknowledge security and open
SendKeys "NO", True

End Sub

of course I'm missing the part that would rename the object. I guess what I'm trying to do at this point is be able to run the docmd.rename command and have it execute in test1.mdb (the shelled db) as opposed to test2.mdb (the db that contains the code). Is this possible? How?

Thanks

View 4 Replies View Related

Access 2003 Shell Error

Jul 20, 2006

Hi

I am attempting to open an Access db from another access db like this:

varDST = mymdbpath
varEX = path/msaccess.exe

varSHELL = Chr$(34) & varEX & Chr$(34) & Chr$(32) & Chr$(34) & varDST &
Chr$(34)

Call Shell(varSHELL, 1)

but I get this error:

MS Office is unable to open the data access page
The field does not exist etc
or
The file you attempted to load not recognised as HTML etc.

It works ok in Access 2000

please hlp.

Thanks
Andy

View 3 Replies View Related

Call Shell(...) - Wait Until App Ends

Feb 4, 2007

Hey guys!

just wondering if there is an way to command

Call Shell("my_bakcup_string",1)

and wait 'till the bakcup program ends to go next command in VBA

thank you! :cool:

View 4 Replies View Related

Opening File In Shell Execute

Dec 20, 2005

I seem to be having a problem opening a file if there happens to be any spaces in the file name. If I open a .pdf no problem acro reader opens it but if it is in word or excell or any other tells me that the file can not be found and seems that only the first part of the file name before a space in the name and the file extention.
example: "Test it.doc" would appear as "Test.doc". somewhere it seems to be trimming the file name.

View 1 Replies View Related

Wait For Shell Execution To Finish?

Jun 19, 2007

I'm using hte Shell() function but this doesn't wait for the executable file to finish so I'm looking for a command line function that would wait until the executable file is finished executing...

I saw this function WaitFor but it is not supported in MS-Access? So, what do I do?

Thanks...

View 7 Replies View Related

Modules & VBA :: Shell - How To Direct To A File

Jun 24, 2013

I use shell to run .exe file eg 7za.exe. How can i direct the output to a text file.

The following don't seem to work

shell "7za.exe > " & chr(34) & "c:log.txt" & chr(34)

or

shell "7za.exe > c:log.txt"

Problem has nothing to do with wait to complete process.

how to direct out to a file via VB.

View 3 Replies View Related

Modules & VBA :: Opening File Using Shell / CPAU

May 27, 2015

I want to open files from a networklocation from VBA, only normal users don't have access to that location (and should preferably not get it).

I instead of using shell("explorer.exe filepath") to open files using windows standard app for the file, which needs userpermissions to the path the file is located, for the currently logged in user.

I'm trying to use CPAU in combination with Shell, because using CPAU you can pass a user/password that has permission to open a process

The only problem is that the filepaths have spaces in them and that is Always a bit of a tricky thing to tackle.

So, for example, this works:

shell("N:GuidelineOntwCPAU -u DomainUser -p password -LWOP -ex " &
Chr(34) & "C:windowsExplorer.exe c: emp est.pdf")

But I cannot get it to work with a file that is on a path with a space in it (or with a space in the name), like

Code : N:EngineeringJB-MATBBBB-004_Panel PinBB-004_Panel Pin.pdf

I'm trying all kinds of thinks:

- adding chr(34) at certain places
- using """
- the above in different versions

But to this point without result.

Trying to figure out the plain cmdline:

Code:
N:GuidelineOntw10_Ontwcpau -u Domain/User -p Password -ex "c:windowsExplorer.exe "c: emp est.pdf""

Doesn't work:

Code:
N:GuidelineOntw10_Ontwcpau -u Domain/User -p Password -ex "c:windowsExplorer.exe "c: emp est 1.pdf""

(difference in filename with a space in it)

The last command start explorer, but doesn't open the file (just as the first line I posted, it opens Explorer, but not the file. Must be something with the way I pass the filename?)

Code : explorer.exe "C: emp est 1.pdf"

Also works in commandline...

View 4 Replies View Related

Modules & VBA :: Shell Function To Open Calculator

Dec 17, 2014

I want to open the Calculator by clicking a command button (using the On Click event).

I have tried the code below but can't get it working. What do I need to change?

Private Sub Command7_Click()
Dim RetVal As Integer
RetVal = Shell("C:Windowscalc.exe", 1)
End Sub

View 2 Replies View Related

Modules & VBA :: Shell And Invalid Procedure Call Or Argument

Feb 23, 2014

I have a form with a button to print preview a report. This report needs one input parameter before executing. The computer this will run on is a touch screen and does not have a keyboard. Windows 7 has a "on screen keyboard" program. I want this to run first so that my user can input the parameter.

I have the following which throws an "Invalid procedure Call or Argument"

Sub CallTeclado()
Dim RetVal
RetVal = Shell("c:windowssystem32osk.exe", vbNormalNoFocus)
End Sub

View 4 Replies View Related

Forms :: Cannot Open External App Using Shell In Access 2013

Aug 19, 2014

In previous versions of Access (i.e 2003 and prior) I could use the following code in the On Click event of a form's command button to open an external file:

Dim stAppName As String
stAppName = "C:Program FilesCadroTransPost PlusTransPostPlus.exe"
Call Shell(stAppName, 1)

However, I'm now using Access 2013 and it wont allow me to use this anymore, it gives me the following error:

Runtime Error '5"'
Invalid procedure call or argument

Why this doesn't work in Access 2013?

View 1 Replies View Related

Modules & VBA :: How To Disable Buttons From Another App Which Is Called By Shell Execute

Sep 30, 2013

I'm using shellexecute in my form whenever a picture is clicked the respective program/ application will open to show the picture. Because I want to see the picture more clearly by zooming it in or out. But the problem is I don't know how to disable the delete button and prev./next button, because I want the user use the program only to zoom it in.

View 4 Replies View Related

Modules & VBA :: GetElementByID With Internet Explorer Using Shell Windows

Jul 16, 2013

I can currently open a new internet explorer instance, navigate to my URL, then use the .getElementByID to insert my preference into a textbox on the page. Looks like this:

Code:
Dim oIE As Object
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Navigate "URL of my Choice"
Do While oIE.Busy Or oIE.ReadyState <> READYSTATE_COMPLETE
DoEvents

[Code] ....

View 7 Replies View Related

Modules & VBA :: Using Shell Function To Dynamically Call Different Pdfs That Are In A Directory?

Aug 13, 2013

I'm looking to use the shell function to dynamically call different pdfs that are in a directory. However I'm getting run time error 5 "Invalid procedure or call argument".

Here is the code (very basic I know)..

Private Sub Liste_Documentation_DblClick(Cancel As Integer)
Dim PathName As String
PathName = Me.Liste_Documentation.Column(2)
' Debug.Print PathName
Shell PathName
End Sub

A typical filepath name is as follows..

S:VenteVendeursMarcCRMDOCSDiligences KYC - LABFT - V 2013 04 23.pdf

View 8 Replies View Related

General :: Hidden Access Shell / Runtime And Print Preview Custom Ribbon

Dec 17, 2013

I have created an application. It has a split front end and back end. I plan to distribute the runtime version. I have used code throughout that "hides" the microsoft access shell for popup (modal) windows. In every form & report I have a function to show or hide the access window. Everything works great until I get to my reports. I open reports in print preview. I created a custom table (USysRibbons) and added a Reports print preview ribbon & xml. I assigned that ribbon to my report(s), and I assigned it in options as the default ribbon. If I test the ribbon (by working in the database using "shift" open) I see my ribbon. But, in when I open app without shift or or if I emulate runtime, I can't get the ribbon.

I have multiple popups forms, several non popup forms and a couple of reports.I just want to keep all the access background stuff hidden - except for needing the ability to print.

View 1 Replies View Related

Forms :: Copying Command Button Appearance Properties To Other Command Buttons

Dec 17, 2013

I am rewriting an old Access 2003 database in Access 2010. When creating new command buttons, the current theme gives them a default appearance. I need to apply this appearance to old command buttons. I know there is a way to select the default button and apply its properties to others quickly. I have done it before but didn't write the process down .

View 2 Replies View Related

Modules & VBA :: Static Shell Function Call Works But Dynamic Call Fails

Sep 4, 2013

I'm having to recode some old MS Access DBs so they will run in the following environments:

Office 2000 on WinXP
Office 2003 on WinXP
Office 2010 on WinXP
Office 2000 on Win7
Office 2003 on Win7
Office 2010 on Win7

When I wrote my code for Office 2000 on WinXP things were simple because directory paths were the same across all computers and I could hard code pathing when using a shell command to launch other files.

My new approach is to make a function call to the Windows registry to determine the default executable and path for opening a file based upon its extension (see apicFindExecutable in basWindows API module).

I'm able to use code to create a shell call and debug print it to the immediate window. If I put my cursor in the immediate window at the end of the shell call and hit [enter] the external file will open as desired. If I try to open the external file directly through code, I get a file not found error.

To recreate the error take the following steps:

(1) browse to files that are accessible from your computer
(2) click the PREPARE DATA AND OPEN MAIL MERGE DOCUMENTS command button

Shell function call is made by the fnOpenFile function located in the basOpenFile module. There has to be a trick here that I'm missing.

View 5 Replies View Related

Command

Sep 18, 2006

Hi,

I have a question,

I made a Macros called AutoExec to run "beginning" Function

Function beginning()
If len(Command)>0 then
....................
End if
End Function

But, it has "compile error: Can't find project or library"

Why?
What's wrong with it?
Thanks.

View 2 Replies View Related

Need Help!! With Command..

Feb 28, 2006

hi,

i need serious help with my access project...

im designing a database for videoshop for loans in access. i have got my movies and loans tables (along with others) and have got them as a one to many (loans to movies) and have got Rental ID as Primary key in Loans table and got that linked to Rental ID# in movies table.

i want some sort of command in the loans form so that when a customer loans out a movie it will update the movies table (rented out field).

the fields that i have got in the loans table are:

Rental ID
Customer ID#
Movie Rented Out
Date Rented Out
Other Rental Details
Rental Duration
Daily Fine Rate

the fields in the movies table are:

Movie Title
Movie Quantity
Movie Description
Genres
Rating
Director
Popularity
Rented Out
In Stock
Supplier ID#
Rental ID#
Stores ID#


if anyone whos reading this knows how i can do this then it will be highly appreciated if u replied to this thread.

thankssssssssssssssssss.....

adeel.

View 1 Replies View Related

Command Button To Set Value

Apr 20, 2006

I have been working on this for awhile, and can't figure it out for the life of me!

I have a form set up with a drop down box that lets me pick from values from a table based off of the Primary Key of that table (Row Source = SELECT Order.OrderID, Order.OrderName from Order). I have a button on the form that I want to set a value (Closed) from the table entry based off of the order selected.

Pseudo code would go something like this.

Closed.Value = True Where Table.Order.OrderID = SelectedOrderID



Table.Order is a Table Named Order (obviously)
Closed is a yes/no field in my Order table
OrderID is the primarykey of the table Order
SelectedOrderID is the drop down box.

Any help would be greatly appreciated!

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved