以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]excel 图片尺寸调整代码问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=91241)

--  作者:freeants
--  发布时间:2016/10/5 8:00:00
--  [求助]excel 图片尺寸调整代码问题
Dim exa As String

Dim Book As New XLS.Book(ProjectPath & "Attachments\\fabricdeveloping.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)

Book.Build() \'生成细节区

exa =ProjectPath & "reports\\" & Tables("面料开发").current("编号")   & ".xls"
Book.Save(exa)

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(exa)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rng As MSExcel.Range
Dim Pic As MSExcel.shape

For Each Pic In ws.shapes
    On Error Resume Next
    
    rng = pic.TopLeftCell                     
     With Pic
             If .Height / .Width > rng.Height / rng.Width Then
             .Height = rng.Height - 5
             .Top = rng.Top + 2.5
             .Left = rng.Left + (rng.Width - .Width) / 2
          \'   .Placement = xlMoveAndSize                  
         Else
             .Width = rng.Width - 5
             .Left = rng.Left + 2.5
             .Top = rng.Top + (rng.Height - .Height) / 2
          \'   .Placement = xlMoveAndSize
        End If
    End With
Next
App.Visible = True
////////////////////////////////////////////////////////////

以上代码作用是在excel里面单元格里面放入的照片,根据单元格大小自动缩放大小, 其中 xlMoveAndSize  在VBA里面可以用,但是在foxtable里面无法运行,请问如何写

--  作者:狐狸爸爸
--  发布时间:2016/10/5 9:04:00
--  
.Placement = 1
--  作者:湛江智
--  发布时间:2018/4/20 16:25:00
--  回复:(狐狸爸爸).Placement = 1
老大,上面的代码放在哪个事件里?
--  作者:有点甜
--  发布时间:2018/4/20 16:28:00
--  
写在一个按钮里面调用。