Glaucio Santos
26-11-2013 08:28:01
Olá,
Estou com um problema em um projeto VBA, quando o executo o projeto, e clico no objeto imagem para carregar uma foto, e se eu precisar cancelar, o mesmo apresenta o erro 53. Segue o codigo que to usando:
Private Sub Image1_Click()
Dim myPictName As String
Dim lLinha As Long
myPictName = Application.GetOpenFilename(filefilter:="Picture Files,*.ico;*.bmp;*.jpg")
If IsNumeric(lblCod.Caption) = True Then
Set currentFind = Worksheets("Clientes").Range("A:A").Find(lblCod.Caption, , _
Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, _
Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False)
lLinha = currentFind.Row
Else
lLinha = Sheets("Clientes").Cells(Rows.Count, 1).End(xlUp).Row + 1
End If
If myPictName <> "" Then
Me.Image1.Picture = LoadPicture(myPictName)
Image1.PictureSizeMode = fmPictureSizeModeStretch
Image1.Visible = False
Image1.Visible = True
Worksheets("Clientes").Cells.Range("m" & lLinha).Value = myPictName
End If
End Sub
Desde já agradeço ajuda.
Um abraço.
Estou com um problema em um projeto VBA, quando o executo o projeto, e clico no objeto imagem para carregar uma foto, e se eu precisar cancelar, o mesmo apresenta o erro 53. Segue o codigo que to usando:
Private Sub Image1_Click()
Dim myPictName As String
Dim lLinha As Long
myPictName = Application.GetOpenFilename(filefilter:="Picture Files,*.ico;*.bmp;*.jpg")
If IsNumeric(lblCod.Caption) = True Then
Set currentFind = Worksheets("Clientes").Range("A:A").Find(lblCod.Caption, , _
Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, _
Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False)
lLinha = currentFind.Row
Else
lLinha = Sheets("Clientes").Cells(Rows.Count, 1).End(xlUp).Row + 1
End If
If myPictName <> "" Then
Me.Image1.Picture = LoadPicture(myPictName)
Image1.PictureSizeMode = fmPictureSizeModeStretch
Image1.Visible = False
Image1.Visible = True
Worksheets("Clientes").Cells.Range("m" & lLinha).Value = myPictName
End If
End Sub
Desde já agradeço ajuda.
Um abraço.