VB6 提取Excel 中图片,提取出的图片无法显示
用以下命令从Excel 中提取的图片,不能全部图片,每次不显示的图片编号还不一样。求高手指教。谢谢。Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Dim a(1 To 6) As String
Dim b(1 To 20) As String
Dim n As Integer
a(1) = "1-1"
a(2) = "1-2"
a(3) = "2-1"
a(4) = "2-2"
a(5) = "3-1"
a(6) = "3-2"
b(1) = "0001"
b(2) = "0002"
b(3) = "0003"
b(4) = "0004"
b(5) = "0005"
b(6) = "0006"
b(7) = "0007"
b(8) = "0008"
b(9) = "0009"
b(10) = "0010"
b(11) = "0011"
b(12) = "0012"
n = 1
For j = 1 To 12
For i = 1 To 6
Set xlBook = xlApp.Workbooks.Open("C:\Users\HG\Desktop\Temp1\" & b(i) & "\" & a(i))
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Activate
Clipboard.Clear
xlSheet.Shapes(1).Copy
Image1.Picture = Clipboard.GetData
SavePicture Image1, "C:\Users\Huaguo\Desktop\Temp2\" & n & ".jpg"
n = n + 1
xlBook.Close
xlApp.Quit
Next i
Next j
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
End Sub