Dim maxW AsDouble: maxW = CentimetersToPoints(14) Dim maxH AsDouble: maxH = CentimetersToPoints(11)
Dim š As InlineShape Dim r AsDouble' Width/Height ratio
ForEach š In ActiveDocument.InlineShapes
r = š.Width / š.Height 'aspect ratio AR If (š.Width > maxW) Then
š.Width = maxW 'resize horizontally
š.Height = š.Width / r 'keep AR EndIf If (š.Height > maxH) Then
š.Height = maxH 'resize vertically
š.Width = š.Height * r 'keep AR EndIf Next š
Do not be shy about using arrays, they are not hard to use.
Dim people(2) As String
people(0) = "John Henry"
people(1) = "Catherine Weaver"
'access the first element in the array
The split() function will make arrays to play with. For this example we are going to use split(string) and split(string, delimiter). The function returns an array of strings or string if it can not find the delimiter.
Dim myarray() as string
Dim mytext as string
Mytext = "the big red dog sat on the hill"
Myarray = split(mytext)
Dim index as integer
Index = 0
Dim output as string
Output = ""
For index to ubound(Myarray) -1
Output = output & "index:" & index & " " & myarray(index)