Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening WIndows Explorer windows from Access

Status
Not open for further replies.

RichardWebster

IS-IT--Management
Jul 12, 2006
4
GB
I am a lawyer and I have a Access 2000 database which stores information about client's matters and is used to produce Word docs from it. On my main Matters Form which gives the basic details of a particular matter there is a button which calls a procedure to open the Word Open Docs dialogue as follows:

Sub OpenDocsForMatter()

Dim oApp As Word.Application

On Error Resume Next
Set oApp = GetObject(, "Word.Application")
If oApp Is Nothing Then
Set oApp = CreateObject("Word.Application")
End If

oApp.Activate
oApp.Visible = True

'goes to the directory with a name related to the currently
'open record on the Matters Form - MWP is a function that
'points to that
oApp.ChangeFileOpenDirectory MWP()
oApp.Dialogs(wdDialogFileOpen).Show

End Sub

I would like to be able to open the same folder in Windows Explorer so I am not limited to opening the documents in Word as some may be PDFs or TIFs Does anyone know how it can be done in VBA for Office 2000?
 
In ac2003 you may try this:
Application.FollowHyperlink MWP()

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, but I'm using Access 2000. As a newbie here I didn't understand what you meant by Application.FollowHyperlink - "Application" was in green bold and underlined.
 
I did a search for "Common Dialog" since that is what I use in VB6 and I found this:


At the bottom is a function that worked quite well when I tested it.
Here is the Function
Code:
Function PickFolder(strStartDir As Variant) As String
    Dim SA As Object, F As Object
    Set SA = CreateObject("Shell.Application")
    Set F = SA.BrowseForFolder(0, "Choose a folder", 0, strStartDir)
    If (Not F Is Nothing) Then
        PickFolder = F.Items.Item.path
    End If
    Set F = Nothing
    Set SA = Nothing
End Function
 
How are ya RichardWebster . . .

Have a look here: Browse for Files

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top