Re: [算表] 重複照片格式貼上Excel

作者: njp2942u4 (小M)   2014-07-28 10:56:28
另外 目前新增功能 如果中間再插入步驟的話 步驟號碼會自動再跳號不必手動修改!
整個檔案部分內容放置圖一
完整檔案放置在最後一頁
但是寫完VBA 不知道出了甚麼問題 仍然無法使用?
成果是希望如此檔案 http://1drv.ms/1AnLV1s
Sub Ex()
Dim Fs As Object, E, i As Integer, P, ii As Integer
With CreateObject("Scripting.FileSystemObject").GetFolder("d:\相片\") '<-修改
為你要查詢之資料夾假設在d槽
i = 1
For Each E In .SubFolders
If i > ActiveWorkbook.Sheets.Count Then
Sheets.Add(, Sheets(Sheets.Count)).Name = E.Name
Else
Sheets(i).Name = E.Name '<-新檔名取代品名以及舊檔名
End If
ii = 1
For Each P In E.Files
If InStr(UCase(P.Name), ".JPG") Then
With Sheets(i).Pictures.Insert(P)
.Top = Cells(ii, 2).Top
.Left = Cells(ii, 2).Left
.Width = 50
.Height = 50
End With
ii = ii + 5
End If
Next
i = i + 1
Next
Dim St As Worksheet: Set St = ThisWorkbook.Worksheets("Sheet1")
Dim Mx
Workbooks.Open "D:\Book2.xls"假設在檔名為Book2
Mx = Range(St.[A1], St.[C10])
Workbooks("Book2").Sheets("Sheet1").[A1].Resize(UBound(Mx, 1), UBound(Mx, 2))
= Mx
Workbooks("Book2").Close True
End With
End Sub
作者: soyoso (我是耀宗)   2014-07-28 12:15:00
無法使用是無符合預期還是有錯誤產生呢?

Links booklink

Contact Us: admin [ a t ] ucptt.com