| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1143 人关注过本帖
标题:VB6 提取excel 中的图片无法显示
取消只看楼主 加入收藏
zhgfeng20
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2020-8-13
结帖率:100%
收藏
 问题点数:0 回复次数:0 
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\HG\Desktop\Temp2\" & n & ".jpg"
                     n = n + 1
                     xlBook.Close
                     xlApp.Quit
                     Set xlSheet = Nothing
                     Set xlBook = Nothing
                     set xlApp=nothing
                     
             Next i
       Next j
      
    xlApp.Quit
    Set xlSheet = Nothing
    Set xlBook = Nothing
    set xlApp=nothing
   
End Sub
搜索更多相关主题的帖子: excel Dim 图片 Nothing Set 
2020-08-23 19:19
快速回复:VB6 提取excel 中的图片无法显示
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016514 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved