您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 旅游娱乐 > VBA统一处理WORD中的图片大小
SubAdjustPicWidthAndHeight()'AltE'AdjustPicWidthAndHeight宏''Dimn,mDimblnisinlineshapeAsBooleanDimmylineshapeAsInlineShapeOnErrorResumeNext'忽略错误'ForEachmylineshapeInActiveDocument.InlineShapes'Ifmylineshape.Heightmylineshape.WidthThen'Selection.InlineShapes.ConvertToShape'Selection.ShapeRange.IncrementRotation90'EndIf'Next'Forn=1ToActiveDocument.InlineShapes.Count'inlineshapes类型的图片'h=ActiveDocument.InlineShapes(n).Height'w=ActiveDocument.InlineShapes(n).Width'ActiveDocument.InlineShapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比'IfhwThen'blnisinlineshape=ture'Selection.InlineShapes(n).ConvertToShape'Selection.ShapeRange.IncrementRotation-90'EndIf'Nextnm=ActiveDocument.InlineShapes.CountForn=1To2'inlineshapes类型的图片ActiveDocument.InlineShapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比ActiveDocument.InlineShapes(n).Height=153'设置图片高度为243pxActiveDocument.InlineShapes(n).Width=243'设置图片高度为153px'ActiveDocument.InlineShapes(n).Range.Paragraphs(1).Range.ParagraphFormat.CharacterUnitFirstLineIndent=0'ActiveDocument.InlineShapes(n).Range.Paragraphs(1).Range.ParagraphFormat.FirstLineIndent=0'ActiveDocument.InlineShapes(n).Range.Paragraphs(1).Range.ParagraphFormat.Alignment=wdAlignParagraphCenterNextnForn=1To2'inlineshapes类型的图片ActiveDocument.Shapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比ActiveDocument.Shapes(n).Height=153'设置图片高度为153pxActiveDocument.Shapes(n).Width=243'设置图片高度为243pxNextnForn=3Tom'inlineshapes类型的图片ActiveDocument.InlineShapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比ActiveDocument.InlineShapes(n).Height=297'设置图片高度为297pxActiveDocument.InlineShapes(n).Width=405'设置图片高度为405pxNextnForn=3Tom'inlineshapes类型的图片ActiveDocument.Shapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比ActiveDocument.Shapes(n).Height=297'设置图片高度为297pxActiveDocument.Shapes(n).Width=405'设置图片高度为405pxNextnWithSelection.ParagraphFormat.LeftIndent=CentimetersToPoints(0).RightIndent=CentimetersToPoints(0).SpaceBefore=50.SpaceBeforeAuto=False.SpaceAfter=50.SpaceAfterAuto=False.LineSpacingRule=wdLineSpaceMultiple.LineSpacing=LinesToPoints(3).Alignment=wdAlignParagraphCenter.WidowControl=False.KeepWithNext=False.KeepTogether=False.PageBreakBefore=False.NoLineNumber=False.Hyphenation=True.FirstLineIndent=CentimetersToPoints(0).OutlineLevel=wdOutlineLevelBodyText.CharacterUnitLeftIndent=0.CharacterUnitRightIndent=0.CharacterUnitFirstLineIndent=0.LineUnitBefore=10.LineUnitAfter=10.MirrorIndents=False.TextboxTightWrap=wdTightNone.AutoAdjustRightIndent=True.DisableLineHeightGrid=False.FarEastLineBreakControl=True.WordWrap=True.HangingPunctuation=True.HalfWidthPunctuationOnTopOfLine=False.AddSpaceBetweenFarEastAndAlpha=True.AddSpaceBetweenFarEastAndDigit=True.BaseLineAlignment=wdBaselineAlignAutoEndWithEndSubSub处理扫描照片()''处理扫描照片宏''Dimn,mDimblnisinlineshapeAsBooleanDimmylineshapeAsInlineShapeOnErrorResumeNext'忽略错误m=ActiveDocument.InlineShapes.CountForn=1To2'inlineshapes类型的图片ActiveDocument.InlineShapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比ActiveDocument.InlineShapes(n).Height=153'设置图片高度为243pxActiveDocument.InlineShapes(n).Width=243'设置图片高度为153pxNextnForn=1To2'inlineshapes类型的图片ActiveDocument.Shapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比ActiveDocument.Shapes(n).Height=153'设置图片高度为153pxActiveDocument.Shapes(n).Width=243'设置图片高度为243pxNextnForn=3Tom'inlineshapes类型的图片ActiveDocument.InlineShapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比ActiveDocument.InlineShapes(n).Height=297'设置图片高度为297pxActiveDocument.InlineShapes(n).Width=405'设置图片高度为405pxNextnForn=3Tom'inlineshapes类型的图片ActiveDocument.Shapes(n).LockAspectRatio=msoFalse'不锁定图片的纵横比ActiveDocument.Shapes(n).Height=297'设置图片高度为297pxActiveDocument.Shapes(n).Width=405'设置图片高度为405pxNextnWithSelection.ParagraphFormat.LeftIndent=CentimetersToPoints(0).RightIndent=CentimetersToPoints(0).SpaceBefore=50.SpaceBeforeAuto=False.SpaceAfter=50.SpaceAfterAuto=False.LineSpacingRule=wdLineSpaceMultiple.LineSpacing=LinesToPoints(3).Alignment=wdAlignParagraphCenter.WidowControl=False.KeepWithNext=False.KeepTogether=False.PageBreakBefore=False.NoLineNumber=False.Hyphenation=True.FirstLineIndent=CentimetersToPoints(0).OutlineLevel=wdOutlineLevelBodyText.CharacterUnitLeftIndent=0.CharacterUnitRightIndent=0.CharacterUnitFirstLineIndent=0.LineUnitBefore=10.LineUnitAfter=10.MirrorIndents=False.TextboxTightWrap=wdTightNone.AutoAdjustRightIndent=True.DisableLineHeightGrid=False.FarEastLineBreakControl=True.WordWrap=True.HangingPunctuation=True.HalfWidthPunctuationOnTopOfLine=False.AddSpaceBetweenFarEastAndAlpha=True.AddSpaceBetweenFarEastAndDigit=True.BaseLineAlignment=wdBaselineAlignAutoEndWithEndSub
本文标题:VBA统一处理WORD中的图片大小
链接地址:https://www.777doc.com/doc-1892167 .html