我需要帮助通过VB压缩Excel工作簿中的所有图像(电子邮件格式96 ppi)。
我尝试过sendkey,但似乎不起作用。
Sub test()
Dim wsh As Worksheet
Set wsh = Worksheets("Sheet1")
wsh.Activate
wsh.Shapes(1).Select
SendKeys "%JP", True
SendKeys "%M", True
SendKeys "%e", True
SendKeys "~", True
End Sub
发布于 2019-04-22 00:48:03
也许下面的“解决方案”对你有帮助。
Sub test()
Dim wsh As Worksheet
Set wsh = Worksheets("Sheet1")
wsh.Activate
wsh.Shapes(1).Select
SendKeys "%e", True
SendKeys "~", True
Application.CommandBars.ExecuteMso "PicturesCompress"
End Sub
但是如果你没有选择任何图片,当你调用Application.CommandBars.ExecuteMso "PicturesCompress"
时,你会看到下面的对话框。如果您选择Web/Screen,您将获得96dpi的分辨率。
发布于 2019-04-22 16:42:48
我找到了这个解决方案,它对我很有效。谢谢你,Storax
Sub test()
Dim wsh As Worksheet
Set wsh = Worksheets("Sheet1")
wsh.Activate
wsh.Shapes(1).Select
SendKeys "%w", True
SendKeys "~", True
Application.CommandBars.ExecuteMso "PicturesCompress"
End Sub
https://stackoverflow.com/questions/55783549
复制相似问题