人气 3966

Excel插入多个图片 [复制链接]

拥抱大树 2016-12-19 16:43:29
Excel在单元格里插入多张图片。点击按钮,自动往单元格插入多张选中的图片
菜单栏选择“开发工具”-“插入”-“按钮”,指定相关的宏代码。
作者:Excel小子-Office中国Excel插入多个图片操作动画
1482137209912316.gif (119.4 KB, 下载次数: 0, 售价: 3 金钱)
Excel插入多个图片详细VBA代码:      Sub SelectFile()   '选择单一文件  Dim s, p, c  Dim rg As Range   With Application.FileDialog(msoFileDialogFilePicker)    .AllowMultiSelect = False   '单选择    .Filters.Clear   '清除文件过滤器    .AllowMultiSelect = True    .Filters.Add "All Files", "*.*"      '设置两个文件过滤器    If .Show = -1 Then   'FileDialog 对象的 Show 方法显示对话框,并且返回 -1(如果您按 OK)和 0(如果您按 Cancel)。     For Each p In .SelectedItems     Set rg = ActiveCell.Offset(c, 0)        ActiveSheet.Shapes.AddShape(msoShapeRectangle, rg.Left, rg.Top, rg.Width, rg.Height).Select        Selection.ShapeRange.Line.Visible = msoFalse        With Selection.ShapeRange.Fill        .Visible = msoTrue        .UserPicture p        .TextureTile = msoFalse        .RotateWithObject = msoTrue        End With        c = c + 1        Next p    End If  End WithEnd Sub
您需要登录后才可以回帖 登录 | 立即注册

QQ|手机版|精益人 ( 沪ICP备19004111号-1 )

GMT+8, 2024-6-3 00:38 , Processed in 0.249726 second(s), 23 queries .

Powered by Lean.ren X3.5 Licensed  © 2001-2030 LEAN.REN