Excel 2016 - 自升级到Excel 2016以来生成jpg图像的宏问题 [英] Excel 2016 - problems with macro that generates a jpg image since upgrade to Excel 2016
问题描述
Hello社区,
自升级以来到Excel 2016遇到一个宏的问题,该宏生成指定的excel区域的jpg图像。在以前的版本中,它没有问题,但自升级以来,宏只生成一个空白的jpg。有
有人经历过类似的事吗?代码如下:
公共函数exportRange(区域为范围,ws为工作表,路径为字符串)
  Application.ScreenUpdating = True
  Application.DisplayAlerts = True
  Dim output As String
  Dim zoom_coef As Single
  output = path
  zoom_coef = 70 / ws.Parent.Windows(1).Zoom
  area.CopyPicture xlPrinter
     Dim chartobj作为ChartObject:设置chartobj = ws.ChartObjects.Add(0,0,area.Width * zoom_coef,area.Height * zoom_coef)
         chartobj.Select
    chartobj.Chart.Paste
    chartobj.Chart.Export输出,"jpg"
      chartobj.Delete
End Function
<你好NikHag,
感谢您在MSDN论坛上发帖。
参考:
https://social.msdn.microsoft.com /论坛/办公室/ EN-US /家?论坛= exceldev
感谢您的理解和支持。 < /跨度> 跨度> 跨度> 跨度> 跨度> 跨度> 跨度> 跨度> 跨度> 跨度> <跨度> <跨度> <跨度> <跨度> <跨度> <跨度> <跨度> <跨度> <跨度> <跨度> <跨度> <跨度> <跨度> 跨度> 跨度> 跨度> 跨度> 跨度>
最诚挚的问候,
Neda Zhang 跨度> 跨度> 跨度> 跨度>
Hello community,
I have since the upgrade to Excel 2016 experienced a problem with a macro that generates a jpg image of a designated excel area. In the previous versions, it worked without problems but since the upgrade the macro only generates a blank jpg. Have anyone experienced something similar? The code is the following:
Public Function exportRange(area As Range, ws As Worksheet, path As String)Application.ScreenUpdating = True
Application.DisplayAlerts = True
Dim output As String
Dim zoom_coef As Single
output = path
zoom_coef = 70 / ws.Parent.Windows(1).Zoom
area.CopyPicture xlPrinter
Dim chartobj As ChartObject: Set chartobj = ws.ChartObjects.Add(0, 0, area.Width * zoom_coef, area.Height * zoom_coef)
chartobj.Select
chartobj.Chart.Paste
chartobj.Chart.Export output, "jpg"
chartobj.Delete
End Function
Hi NikHag,
Thank you for posting in MSDN forum.
Since your issue is more related to Excel development, I will move this thread to the more related forum for better support.
Reference: https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev
Thanks for your understanding and support.
Best Regards,
Neda Zhang
这篇关于Excel 2016 - 自升级到Excel 2016以来生成jpg图像的宏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!