Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.
Private Sub cmdAdd_Click() ' User asked to add a new photo Dim strPath As String ' Grab a copy of the Office file dialog With Application.FileDialog(msoFileDialogFilePicker) ' Select only one file .AllowMultiSelect = False ' Set the dialog title .Title = "Locate the image file" ' Set the button caption .ButtonName = "Choose" ' Make sure the filter list is clear .Filters.Clear ' Add two filters .Filters.Add "JPEGs", "*.jpg" '.Filters.Add "Bitmaps", "*.bmp" ' Set the filter index to 2 .FilterIndex = 2 ' Set the initial path name .InitialFileName = "B:\Dropbox\Business Documents\Database\Database Images\" ' Show files as thumbnails .InitialView = msoFileDialogViewThumbnail ' Show the dialog and test the return If .Show = 0 Then ' Didn't pick a file - bail Exit Sub End If ' Should be only one filename - grab it strPath = Trim(.SelectedItems(1)) ' Set an error trap On Error Resume Next ' Set the image Me.txtImage = strPath ' Set the message in case Image control couldn't find it Me.lblMsg.Caption = "Failed to load the picture you selected." & _ " Click Add to try again." End With ' Put focus in a safe place Me.cmdCloseForm.SetFocus End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.