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!
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.
It has been ages since I visited the forum, feb 23 to be more exact... Life has been hell and am crammed for time... This time I have run into something I cannot get a handle on...
On just about any PC this db I build works perfectly, but on one I having some trouble (see attached). I have never experience this.
If I (or the customer) opens the database either by double clicking on the database on the network, double clicking the shortcut it looks like [see attachments OnOpen]
This is not very nice offcourse but is simply solved by clicking the maximize button. After which we see this... [see attachments AfterMax]
From this I can maximize the database screen, but not the form. It stays like that, unless I click design and then Form view. After which the database works normal.
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
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.
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. "
I have a form that opens from a different form based on the primary key within the original form. Unfortunately it seems to be opening a new record every time I open the form--not only from the original form but also straight from the sidebar.
The command button that opens the second form from the first uses the following VBA:
This exact coding worded perfectly in a similar set of forms that I had created; the only difference is a change in the form name & primary key field.
Add onto this, I think that the code DOES work, but then it immediately opens another new record. When I open the second form from the command button, then change to Design View, the form's Filter property is set to [Event_ID]=X (where X is the proper key from the first form) and Filter On Load is set to Yes. The X in the Filter changes accordingly when it changes in the first form. Also, every time I open the form a new record is added to the underlying table.
I've tried setting "Allow Additions" in the second form to No, but then when I open the form nothing appears. Literally; the entire form is blank, no labels, textboxes, combos, buttons or anything. When going to Design View it's still all there.
I've also checked the On_Load, On_Current & Form_Current events and found nothing. I even deleted them and the problem still occurred.
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.
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?)
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
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.
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
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
I'm trying to add data about a form to a table when the On_Current event fires. The data I want to add is: windows login username
date and time the On_Current event occurred name of the form that was opened that the form was opened the number of the record (ID) in the table the form is based on
I have the following code
Private Sub Form_Current() If Me.NewRecord Then Call FlimOpen("OR IR No", "OPENED") Else Call FlimOpen("OR IR No", "OPENED")
[Code] ....
Excuse the use of 'FlimOpen' but I needed a unique word that I would remember (inspired by FlimFlam the cat on the children's channel CBeebies here in the UK)
I try to compile and I get an error about the wrong number of arguments or invalid property assignment. However, the event does fire correctly when I open the form or move from one record to another so something's working!
I need to hide my subform on load or open of the main form but am experiencing some weird results. I have tried putting Me.SubForm.Form.Visible = False in both the on open and the on load of the main form and it works only if the tables on which the subform have records in them. If the tables for the subforms are empty I get an error 2467 telling me that "The expression you entered refers to an object that is closed or doesn't exist." I find this strange because from all I can find the subform loads first.
How can I hide the subform when the main form opens no matter what records exist or don't?
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.
I'me running on Win7, Office 2010, Acc2003 format (.mdb), writing data to Excel 2010 (.xlsx)I have code to create an Excel file, send record set data to it, and then add some formulas and formatting. I was trying to tune up the formulas, when I got a pull back:Access VBA code suddenly stops running, and the file gets displayed in Excel
Code: 'ApXl is Application.Excel 'xlWSh is the Excel WorkSheet 'rst is my DAO.Recorset
I want to display a picture (or pictures) from Imagelist in the picturebox (KIBES_picture).But I am getting a type mismatch error in the last line. What am I doing wrong?
Code: Public Sub load_picture() Dim iml As ImageList Set iml = New ImageList iml.ListImages.Add , , LoadPicture("K:Kapa-Planung ElektrikKibes_DatabaseAufbausystemme2_Innenbeleuchtung .00000-0002_Treppebeleuchtung_ueber_2 Schalters_087A00ekran_edycja.jpg") [Forms]![Search]![KIBES_picture].Picture = iml.ListImages(1)
Besides, when I have Listimage(0) I am getting an other error: Index out of bounds. Strange, because the index should start from zero?
Dim fDialog As Object Set fDialog = Application.FileDialog(msoFileDialogFilePicker) Dim varFile As Variant Set Cn = New ADODB.Connection Cn.Open "Provider=SQLOLEDB;data Source=.;" & _ [Code] ....
But I have a problem when my database more than 2000 record. I think my problem in
rs.Open "Select * from Table_2", Cn, adOpenKeyset, adLockOptimistic
I have a form with a textbox with the "LinkedIn" profile address that I want the user to be able to pull up when they click a command button. It works, except that the link opens twice in two tabs in the browser. I've checked over the code for the whole form, and this code is only being run from the click event of the button, so why would it open the same tab twice? Here's the code:
Private Sub cmd_Click() Dim ctl As CommandButton Dim txthyper As String Set ctl = Me!cmd txthyper = Me!LinkedIn
I want to my ImageFrame to open as a picture. My problem is that my picture could be either a .jpg or a .png (or whatever). The code below works if I hard code profile_pic.png or profile_pic.jpg. Is there a way to use the wildcard here? (Its not working as written now)
Code:
Dim vFolderPath As String, strFile As String, dirFile As String vFolderPath = DLookup("FolderName", "tblCodes-FolderControl", "FolderKey = '" & "Profile" & "'") dirFile = Dir(vFolderPath & ctrl_people_id & " *", vbDirectory) strFile = "profile_pic." + "*"