压缩,调整大小,然后为图像添加黑色边框 [英] Compress, resize and then add black border to image

查看:129
本文介绍了压缩,调整大小,然后为图像添加黑色边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


在旧版MS Word(2010年,我认为)中,能够使用"记录"创建宏。功能,它只是记录我的鼠标点击让我压缩word文档中的选定图像图像(达到200 dpi),然后将其调整为
85%,最后在边缘周围添加1pt黑色边框。  不幸的是,我现在可以更长时间访问此宏。  


Word的最新版本(2016)不允许我这样做(它似乎不允许我对插入的图像做任何事情)所以现在我卡住了试图找出我必须手动插入宏的代码行。  我已完成剪切,粘贴
并调整有关调整大小百分比的工作,但找不到特定的代码行来压缩已插入的图像或在边缘周围添加1pt黑色边框。  有人可以帮忙吗?  到目前为止我的代码低于...


Sub HSize()

'

'HSize Macro

'

  Dim PecentSize As Integer



      PercentSize = 85



     如果Selection.InlineShapes.Count> 0然后

          Selection.InlineShapes(1).ScaleHeight = PercentSize

          Selection.InlineShapes(1).ScaleWidth = PercentSize

     其他

          Selection.ShapeRange.ScaleHeight Factor:=(PercentSize / 100),_

            RelativeToOriginalSize:= msoCTrue

          Selection.ShapeRange.ScaleWidth Factor:=(PercentSize / 100),_

            RelativeToOriginalSize:= msoCTrue

         结束如果'



b
结束次级


非常感谢


Ian

解决方案


您在Office2010中使用什么代码进行压缩?在Office2016中使用它时会出现任何错误吗?


要设置其边框,请使用代码如下。

 Dim sh As Shape 
'Dim sh As InlineShape
Set sh = ActiveDocument.Shapes(1)
'Set sh = ActiveDocument.InlineShapes(1)
sh.Line.Weight = 1
sh.Line.ForeColor.RGB = RGB(0,0,0)


问候,


Celeste


 


Hi there,

In an older version of MS Word (2010, I think)  was able to create a macro using the "record" feature where it simply recorded my mouseclicks and let me compress a selected image image in a word document (to 200 dpi), and then resize it to 85% and finally add a 1pt black border around the edge.  Unfortunately I now longer have access to this macro.  

The newest version (2016) of Word doesn't let me do that however (it doesn't seem to let me do anything on inserted images) so now I'm stuck with trying to figure out what lines of code I must insert into the macro manually.  I have done a cut, paste and tweak job regarding the percentage resizing, but can't find specific code lines to compress an already inserted image or add a 1pt black border around the edge.  Can anyone assist?  My code so far is below...

Sub HSize()
'
' HSize Macro
'
 Dim PecentSize As Integer

     PercentSize = 85

     If Selection.InlineShapes.Count > 0 Then
         Selection.InlineShapes(1).ScaleHeight = PercentSize
         Selection.InlineShapes(1).ScaleWidth = PercentSize
     Else
         Selection.ShapeRange.ScaleHeight Factor:=(PercentSize / 100), _
           RelativeToOriginalSize:=msoCTrue
         Selection.ShapeRange.ScaleWidth Factor:=(PercentSize / 100), _
           RelativeToOriginalSize:=msoCTrue
          End If '


End Sub

Many thanks

Ian

解决方案

Hi,

What code you do use in Office2010 to compress? Do you get any error when you use it in the Office2016?

To set its border, use code as below.

Dim sh As Shape
'Dim sh As InlineShape
Set sh = ActiveDocument.Shapes(1)
'Set sh = ActiveDocument.InlineShapes(1)
sh.Line.Weight = 1
sh.Line.ForeColor.RGB = RGB(0, 0, 0)

Regards,

Celeste

 


这篇关于压缩,调整大小,然后为图像添加黑色边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆