Lo hice asi:
Esto en un Modulo
Option Explicit
Public Const FILTER_PICTURES As String = "Pictures|*.bmp;*.gif;*.jpg;*.jpeg;*.png;*.dib;*.rle;*.jpe;*.jfif;*.emf;*.wmf;*.tif;*.tiff;*.ico;*.cur"
Public Const MAX_PATH = 260
Public Const MAX_FILE = 260
Public Enum EOpenFiles
OFN_READONLY = &H1
OFN_OVERWRITEPROMPT = &H2
OFN_HIDEREADONLY = &H4
OFN_NOCHANGEDIR = &H8
OFN_SHOWHELP = &H10
OFN_ENABLEHOOK = &H20
OFN_ENABLETEMPLATE = &H40
OFN_ENABLETEMPLATEHANDLE = &H80
OFN_NOVALIDATE = &H100
OFN_ALLOWMULTISELECT = &H200
OFN_EXTENSIONDIFFERENT = &H400
OFN_PATHMUSTEXIST = &H800
OFN_FILEMUSTEXIST = &H1000
OFN_CREATEPROMPT = &H2000
OFN_SHAREAWARE = &H4000
OFN_NOREADONLYRETURN = &H8000&
OFN_NOTESTFILECREATE = &H10000
OFN_NONETWORKBUTTON = &H20000
OFN_NOLONGNAMES = &H40000
OFN_EXPLORER = &H80000
OFN_NODEREFERENCELINKS = &H100000
OFN_LONGNAMES = &H200000
End Enum
Private Type OPENFILENAMEs
lStructSize As Long ' Filled with UDT size
hWndOwner As Long ' Tied to Owner
hInstance As Long ' Ignored (used only by templates)
lpstrFilter As String ' Tied to Filter
lpstrCustomFilter As String ' Ignored (exercise for reader)
nMaxCustFilter As Long ' Ignored (exercise for reader)
nFilterIndex As Long ' Tied to FilterIndex
lpstrFile As String ' Tied to FileName
nMaxFile As Long ' Handled internally
lpstrFileTitle As String ' Tied to FileTitle
nMaxFileTitle As Long ' Handled internally
lpstrInitialDir As String ' Tied to InitDir
lpstrTitle As String ' Tied to DlgTitle
flags As Long ' Tied to Flags
nFileOffset As Integer ' Ignored (exercise for reader)
nFileExtension As Integer ' Ignored (exercise for reader)
lpstrDefExt As String ' Tied to DefaultExt
lCustData As Long ' Ignored (needed for hooks)
lpfnHook As Long ' Ignored (good luck with hooks)
lpTemplateName As Long ' Ignored (good luck with templates)
End Type
Public Declare Function GetFileTitle Lib "COMDLG32" Alias "GetFileTitleA" (ByVal szFile As String, ByVal szTitle As String, ByVal cbBuf As Long) As Long
Public Declare Function GetOpenFileName Lib "COMDLG32" Alias "GetOpenFileNameA" (file As OPENFILENAMEs) As Long
Public Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Public m_sFile As String
Public Function VBGetOpenFileName(Filename As String, Optional FileTitle As String, Optional FileMustExist As Boolean = True, Optional MultiSelect As Boolean = False, Optional ReadOnly As Boolean = False, Optional HideReadOnly As Boolean = False, Optional Filter As String = "All (*.*)| *.*", Optional FilterIndex As Long = 1, Optional InitDir As String, Optional DlgTitle As String, Optional DefaultExt As String, Optional Owner As Long = -1, Optional flags As Long = 0) As Boolean
Dim opfile As OPENFILENAMEs, S As String, afFlags As Long
With opfile
.lStructSize = Len(opfile)
.flags = (-FileMustExist * OFN_FILEMUSTEXIST) Or _
(-MultiSelect * OFN_ALLOWMULTISELECT) Or _
(-ReadOnly * OFN_READONLY) Or _
(-HideReadOnly * OFN_HIDEREADONLY) Or _
(flags And CLng(Not (OFN_ENABLEHOOK Or _
OFN_ENABLETEMPLATE)))
If Owner <> -1 Then .hWndOwner = Owner
.lpstrInitialDir = InitDir
.lpstrDefExt = DefaultExt
.lpstrTitle = DlgTitle
' To make Windows-style filter, replace | and : with nulls
Dim ch As String, i As Integer
For i = 1 To Len(Filter)
ch = Mid$(Filter, i, 1)
If ch = "|" Or ch = ":" Then
S = S & vbNullChar
Else
S = S & ch
End If
Next
S = S & vbNullChar & vbNullChar
.lpstrFilter = S
.nFilterIndex = FilterIndex
' Pad file and file title buffers to maximum path
S = Filename & String$(MAX_PATH - Len(Filename), 0)
.lpstrFile = S
.nMaxFile = MAX_PATH
S = FileTitle & String$(MAX_FILE - Len(FileTitle), 0)
.lpstrFileTitle = S
.nMaxFileTitle = MAX_FILE
' All other fields set to zero
If GetOpenFileName(opfile) = 1 Then
' Success
VBGetOpenFileName = True
Filename = StrZToStr(.lpstrFile)
FileTitle = StrZToStr(.lpstrFileTitle)
flags = .flags
' Return the filter index
FilterIndex = .nFilterIndex
' Look up the filter the user selected and return that
Filter = FilterLookup(.lpstrFilter, FilterIndex)
If (.flags And OFN_READONLY) Then ReadOnly = True
End If
End With
End Function
Public Function StrZToStr(S As String) As String
StrZToStr = Left$(S, lstrlen(S))
End Function
Public Function FilterLookup(ByVal sFilters As String, ByVal iCur As Long) As String
Dim iStart As Long, iEnd As Long, S As String
iStart = 1
If sFilters = "" Then Exit Function
Do
iEnd = InStr(iStart, sFilters, vbNullChar)
If iEnd = 0 Then Exit Function
iEnd = InStr(iEnd + 1, sFilters, vbNullChar)
If iEnd Then
S = Mid$(sFilters, iStart, iEnd - iStart)
Else
S = Mid$(sFilters, iStart)
End If
iStart = iEnd + 1
If iCur = 1 Then
FilterLookup = S
Exit Function
End If
iCur = iCur - 1
Loop While iCur
End Function
Public Sub TraerFotoDir(ByVal xPicture As ucImage)
Dim sFile As String
Dim svName() As String
If VBGetOpenFileName(sFile, Filter:=FILTER_PICTURES) Then
m_sFile = sFile
xPicture.LoadImageFromFile m_sFile
End If
End Sub
Esto en un Boton.
Private Sub Command1_Click()
Call TraerFotoDir(picFoto1)
End Sub
Asi no tengo que agregar el control CommanDialog en mi proyecto.