将图像插入Excel Userform然后编辑

时间:2015-07-23 13:26:08

标签: excel-vba vba excel

我已成功添加/选择图像并加载到用户窗体中。我想知道是否真的要将带有标签(等)的工具箱加载到用户窗体中,这样当您将图像加载到用户窗体时,您可以选择在用户窗体上编辑图像。

提前致谢

这是我用来将图片上传到userform的代码

With Application.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = False
    .ButtonName = "Submit"
    .Title = "Select an image file"
    .Filters.Add "Image", "*.gif; *.jpg; *.jpeg", 1
    If .Show = -1 Then
        ' file has been selected

        ' e.g. show path in textbox
        Me.TextBox1.Text = .SelectedItems(1)

        ' e.g. display preview image in an image control
        Me.Image1.PictureSizeMode = fmPictureSizeModeZoom
        Me.Image1.Picture = LoadPicture(.SelectedItems(1))
    Else
        ' user aborted the dialog

    End If
End With

0 个答案:

没有答案