◆vb导出excel的图片长、宽度控制有关问题
◆vb导出excel的图片长、宽度控制问题
以下是我生成图片程序,但是有一个问题,就是有的图片是小的,有的图片是大的,而且我是想判断图片导入到Excel表格xlsheet.Cells(10, 11)时,如果width大于100,height大于100,就进行缩小处理。
这样的判断应该怎么写的。
以下是未修改的程序,请帮忙修改一下,谢谢了。
xlsheet.Cells(10, 11).Select
Set p = xlsheet.Pictures.Insert( "c:\images\ " & newsmallimg)
p.Height = p.Height / 3 * 2
p.Width = p.Width / 3 * 2
------解决方案--------------------
不会,帮你顶一下
------解决方案--------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim p
Dim i As Double
ActiveSheet.Range( "a1 ").Select
Set p = ActiveSheet.Pictures.Insert( "D:\JackDocument\My Pictures\11345-3-25-401.jpg ")
If p.Width > 100 Or p.Height > 100 Then
i = p.Width / p.Height
If i > 1 Then
p.Width = 100
p.Height = p.Width / i
Else
p.Height = 100
p.Width = p.Height * i
End If
End If
End Sub
------解决方案--------------------
ding up
以下是我生成图片程序,但是有一个问题,就是有的图片是小的,有的图片是大的,而且我是想判断图片导入到Excel表格xlsheet.Cells(10, 11)时,如果width大于100,height大于100,就进行缩小处理。
这样的判断应该怎么写的。
以下是未修改的程序,请帮忙修改一下,谢谢了。
xlsheet.Cells(10, 11).Select
Set p = xlsheet.Pictures.Insert( "c:\images\ " & newsmallimg)
p.Height = p.Height / 3 * 2
p.Width = p.Width / 3 * 2
------解决方案--------------------
不会,帮你顶一下
------解决方案--------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim p
Dim i As Double
ActiveSheet.Range( "a1 ").Select
Set p = ActiveSheet.Pictures.Insert( "D:\JackDocument\My Pictures\11345-3-25-401.jpg ")
If p.Width > 100 Or p.Height > 100 Then
i = p.Width / p.Height
If i > 1 Then
p.Width = 100
p.Height = p.Width / i
Else
p.Height = 100
p.Width = p.Height * i
End If
End If
End Sub
------解决方案--------------------
ding up