Forum Discussion
Compile error: Method or data member not found
hi
i have problem with my VBA code. Here my codes
Dim ErwinG As String
Private Sub CMP_UPLOAD_Click()
On Error GoTo Salah
Dim Erwin As Integer
If Me.TXTNAMA.Value = "" Then
Call MsgBox("Isi terlebih dahulu pada Nama Dokter", vbInformation, "Nama Dokter")
Exit Sub
End If
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
Erwin = Application.FileDialog(msoFileDialogOpen).Show
If Erwin <> 0 Then
ErwinG = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
Me.Image1.Picture = LoadPicture(ErwinG)
Me.Image1.PictureSizeMode = 1
Me.LabelPicture.Caption = ThisWorkbook.Path & "\" & Me.TXTNAMA.Value & ".jpg"
End If
Exit Sub
Salah:
Call MsgBox("Tipe file tidak mendukung untuk ditampilkan, pastikan pilih file dengan tipe *.Jpg*, atau *.Jpeg*", vbInformation, "Simpan Gambar")
End Sub
it says "Compile error: Method or data member not found" when i click on "FOTO" button. if this code success it will be open the explorer and choose any photo's and then save it.
actually, this is youtube tutorial code. i did the same way as the video said. i've tried to ask the author but i dont get the answer.
here the link that video i mean
https://www.youtube.com/watch?v=ycY_6o_DODo&lc=UgwRMyBAPNVOibqhbXR4AaABAg.9LxPENArfzx9OwJCi6DXvM
6 Replies
Does your userform contain a label named LabelPicture ?
- oslowowCopper Contributori thought is not.. where should i put that "LabelPicture"?
You can place it anywhere on the userform.
Alternatively, if you don't need the label, remove the line
Me.LabelPicture.Caption = ThisWorkbook.Path & "\" & Me.TXTNAMA.Value & ".jpg"
from the code. You won't get the error.