Export pictures from excel file into jpg using VBA

后端 未结 7 1313
刺人心
刺人心 2020-11-27 07:17

I have an Excel file which includes pictures in column B and I want like to export them into several files as .jpg (or any other picture file format). The name of the file s

相关标签:
7条回答
  • 2020-11-27 07:38

    ''' Set Range you want to export to the folder

    Workbooks("your workbook name").Sheets("yoursheet name").Select

    Dim rgExp As Range: Set rgExp = Range("A1:H31")
    ''' Copy range as picture onto Clipboard
    rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
    ''' Create an empty chart with exact size of range copied
    With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
    Width:=rgExp.Width, Height:=rgExp.Height)
    .Name = "ChartVolumeMetricsDevEXPORT"
    .Activate
    End With
    ''' Paste into chart area, export to file, delete chart.
    ActiveChart.Paste
    ActiveSheet.ChartObjects("ChartVolumeMetricsDevEXPORT").Chart.Export "C:\ExportmyChart.jpg"
    ActiveSheet.ChartObjects("ChartVolumeMetricsDevEXPORT").Delete
    
    0 讨论(0)
提交回复
热议问题