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 Replies
ADVERTISEMENT
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
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
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
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
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
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
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
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
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
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
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
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
Jul 19, 2006
Is it possible for me to have a Query that pulls up the information I need and then it automatically starts up the windows calculator?
IE: information comes up then the calculator pops up so you can do calculations based on the information being shown.
View 3 Replies
View Related
Jul 1, 2005
I have a table that a created to calculate a running balance.
Fields look like this.
Desc = Text - Description of transaction
Type = Text - Combo Box Debit or Credit on Form
Amount = Currency - Obvious
Date = Date/Time - Obvious
I have two questions. In my form I have the combo box for debit/credit. I want to have the amount field to be either negative or positive depending upon what is selected for the type field.
Secondly, I would like to create a running amount. I have a field in my form for the amount. How would I link it up to create an amount.
Thanks
View 1 Replies
View Related
May 12, 2015
I am trying to build an incentive calculator for my company. I need a query that will take, for each employee,
Append rows as follows:
Emp1 | Attendance |
Emp1 | CSAT Score |
Emp1 | Quality Score |
Emp2 | Attendance |
Emp2 | CSAT Score |
Emp2 | Quality Score |
...etc...
The Attendance, CSAT Score, Quality Score are from a table named PARAMETERS where each department will have them listed as
Dept1 | Attendance | >90% |$10
Dept1 | CSAT Score | >8.0 |$10
Dept1 | Quality Score | >3.5 |$20
Dept2 | Attendance | >95% |$15
...etc...
I can do the lookups needed to find out which department an employee belongs to, but how to get the Employee to be listed in multiple rows like this.
View 4 Replies
View Related
Dec 11, 2013
So basically I need making a function that will count the number of records from another table/query based on a field from the current query.
View 2 Replies
View Related
Feb 3, 2006
hello,
I use macros to open forms (with a query as filters).
I would like to replace macros with code. Any help?
This is what I have for the Open Form macro:
Macro named: OpenMaster
Form Name: Master
View: Form
Filter Name: qryMaster
viewMode: Normal
Thanks.
View 2 Replies
View Related
Oct 23, 2005
I am trying to resolve an issue of being able to use a query from many different forms where the query is dependent on the date selected in the current open form. Right now it calls the function getDate() which works fine. Unfortunatly the function is called before the form is fully loaded and the control I want to pass has no value/doesn't exist yet and I get a
"Runtime error 13 Type-Mismatch"
Here is the function code:
Function getDate() As String
If fIsLoaded("F_SupplierData") Then
getDate = Form_F_SupplierData.txtDate
Else
getDate = "01/01/1901"
End If
End Function
Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function
Is there a way to detect the state of the text field itself (if it is open, closed, dirty)? Or if anyone has a better way to tie a query to multiple forms?
View 5 Replies
View Related
Dec 5, 2014
I have a access 2003 database, and i am wondering if i can't setup a search function in a form that will open a file in windows explorer?
What i would like to do is have a test box that i enter in a number for example: 1234 then have a button named "Search" hit that button and it opens a corresponding file in windows explorer named 1234, or just opens that folder directly..
View 14 Replies
View Related
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
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
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
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
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 1 Replies
View Related
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