Rabu, 08 Agustus 2012

[MS_AccessPros] Re: Opening Documents in Access

 

Art

I use the Scripting Shell function to open external files.

Public Function ScriptShell(strfile As String)
'Purpose : Use instead of Shell().
' Works for shortcuts, too.
'DateTime : 9/28/2007 11:28
'Author : Bill Mosca
'Reference: http://msdn2.microsoft.com/en-us/library/d5fk67ky.aspx
'WScript.Shell object's arguments:
' object.Run(strCommand, [intWindowStyle], [bWaitOnReturn])
'
' [intWindowStyle]:
' 0 Hides the window and activates another window.
' 1 Activates and displays a window. If the window is minimized
' or maximized, the system restores it to its original size
' and position. An application should specify this flag when
' displaying the window for the first time.
' 2 Activates the window and displays it as a minimized window.
' 3 Activates the window and displays it as a maximized window.
' 4 Displays a window in its most recent size and position.
' The active window remains active.
' [bWaitOnReturn]: boolean
Dim WshShell As Object

'VBScript
'Set WshShell = WScript.CreateObject("WScript.Shell")

Set WshShell = CreateObject("WScript.Shell")

'Shortcut example
'WshShell.Run "C:\FRS3000\StartFRS3000.lnk"

WshShell.Run strfile

Set WshShell = Nothing

End Function

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com

--- In MS_Access_Professionals@yahoogroups.com, "Art" <dbalorenzini@...> wrote:
>
> I am designing a document subform called sfmRoofDocuments. It will be a continous form based on the following table structure:
>
> RoofDocumentID - auto number
> InspectionID - Number
> DocumentTypeID - Number
> DocumentTitle - Text
> DocumentPath - Text
> Comments - Memo
>
> For each record I would like to add a two buttons, one to browse to where the file is located and one to view the file. So if the file happens to be a Word file then it would open up in Word, or Excel or if it is an image a Photo Editor. Is there some example code or anyone with any ideas on how I can get this implemented.
>
> Thank you
>
> Arthur Lorenzini
> Sioux Falls, SD
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar