Sure thing....
Shell is a built in function in Access that passes a string to a command line interface....the same as you opening a command window and typing in the string.
Word can be called from a command line by typing in the full path to word. For example, on my PC it is C:\Windows\Program Files\Microsoft Office\Office11\windword.exe If you place a path after that, it will open the specific file in question. So if I type the above and add C:\test.doc at the end, it will open Word with the test.doc file displayed.
Automation is the process where one Office application (Word, Excel, Access, Power Point) can open and control another. For example, I can use Access to open Outlook and send emails to someone in my address list, attaching a record from the access based diaplyed on a Word document. All fun and dandy if you have the experience. Until you get you feet wet with some VBA experience, I would recommnend staying away from automation. Its not really all that tough, but with some programming background and/or a mentor, you can quickly get in over your head.
To execute a Shell command from a button, you create the button on the form. If you use the wizard just pick anything as you will be deleting the code anyway. Open the proteries windw and select the button. Find the OnClick property. It should read "Event Procedure" If you click there a little ellipse (three dots) will appear to the right of the line. Click this and it will bring up the code window. Delete anything between the
Private Sub Commandx_Click() and the
End Sub. Place the code below in its place:
Code:
Dim RetVal As Variant ' This is the variable to hold the result
RetVal = Shell('[i]path to word[/i]' '[i]path to file[/i]')
=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com