Zodihax

Pictures MSWord

Nov 7th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.98 KB | None | 0 0
  1. Sub formatereBilder()
  2. Application.ScreenUpdating = True
  3. Dim StoryRange As Range, bilde As InlineShape, rangeBuf As Range
  4. For Each StoryRange In ActiveDocument.StoryRanges
  5.   For Each bilde In StoryRange.InlineShapes
  6.     Set rangeBuf = bilde.Range.Paragraphs.First.Range
  7.     If rangeBuf.Style <> "Caption" Then
  8.         If rangeBuf.Paragraphs.Last.Next.Style <> "Caption" Then
  9.           bilde.LockAspectRatio = True
  10.           bilde.Width = CentimetersToPoints(12)
  11.           bilde.Line.Weight = 1
  12.           bilde.Line.Style = msoLineSingle
  13.           bilde.Line.ForeColor.RGB = 0
  14.           bilde.Select
  15.  
  16.           'hvis du foretrekker midtstilt, uncomment neste linje
  17.           'Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
  18.           bilde.Range.InsertCaption Label:="Figur", TitleAutoText:="", Title:="", _
  19.           Position:=wdCaptionPositionBelow, ExcludeLabel:=0
  20.         End If
  21.   End If
  22.   Next
  23. Next
  24. Set rangeBuf = Nothing
  25. Application.ScreenUpdating = False
  26. End Sub
Add Comment
Please, Sign In to add comment