View Single Post
  #2  
Old 10-02-2004, 10:43
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Once again I have determined a solution.

Alex, would you look at this and see if there is a more efficient way for me to go about this?

Code:
Sub ShowOpenFile()
Dim OFName As OPENFILENAME
Dim sPath As String

    OFName.lStructSize = Len(OFName)
    OFName.hwndOwner = 0&
    OFName.hInstance = 0&
    OFName.lpstrFilter = "Image Files" + Chr$(0) + "*.jpg;*.bmp;*.gif;*.jpeg;*.ai"
    OFName.lpstrFile = Space$(254)
    OFName.nMaxFile = 255
    OFName.lpstrFileTitle = Space$(254)
    OFName.nMaxFileTitle = 255
    sPath = GetBackEnd
    If sPath = vbNullString Then
        OFName.lpstrInitialDir = "c:\"
    Else
        sPath = Left(sPath, InStrRev(sPath, "\") - 1)
        If Len(Dir(sPath, vbDirectory)) > 0 Then
            OFName.lpstrInitialDir = sPath
        Else
            OFName.lpstrInitialDir = "c:\"
        End If
    End If
    OFName.lpstrTitle = "Select an image File (*.jpg), (*.bmp), (*.gif), (*.ai)"
    OFName.flags = 0

    If GetOpenFileName(OFName) Then
        BrowseOpenFile = OFName.lpstrFile
        txbImagePath.Text = BrowseOpenFile
        If Right$(OFName.lpstrFilter, 3) = ".ai" Then
            With Image1
            .Picture = LoadPicture("c:\pna.bmp")
            .PictureAlignment = fmPictureAlignmentCenter
            .PictureSizeMode = fmPictureSizeModeZoom
            End With
        Else
        With Image1
        .Picture = LoadPicture(BrowseOpenFile)
        .PictureAlignment = fmPictureAlignmentCenter
        .PictureSizeMode = fmPictureSizeModeZoom
        End With
        End If
    Else
        BrowseOpenFile = vbNullString
        MsgBox "No file Selected."
    End If
End Sub
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote