Hello
Sub Macro2()
Dim shp As Shape
Dim doc As Document
Set doc = Documents("docmacrotest")
With doc
Set shp = .Shapes.AddShape(msoShapeRectangle, 50, 50, 100, 200)
shp.Fill.ForeColor.RGB = RGB(0, 255, 0)
End With
End Sub
Sub Macro1()
Dim shp As Shape
Set shp = _
ActiveDocument _
.Sections(1).Headers(wdHeaderFooterPrimary) _
.Shapes.AddShape( _
Type:=msoShape5pointStar, _
Left:=20, Top:=20, _
Width:=100, Height:=100)
shp.Fill.ForeColor.RGB = RGB(0, 255, 0)
End Sub
Sub Macro2()
Dim shp As Shape
Dim doc As Document
Set doc = Documents("docmacrotest")
With doc
Set shp = .Shapes.AddShape(msoShapeRectangle, 50, 50, 100, 200)
shp.Fill.ForeColor.RGB = RGB(0, 255, 0)
End With
End Sub
Sub Macro3()
Dim shp As Shape
Dim doc As Document
Dim i As Long
Dim cm As Double
Dim y As Double
cm = 72 / 2.54
For i = 11 To 20
y = CDbl(i) * cm
Set doc = Documents("docmacrotest")
Set shp = doc.Shapes.AddLine(10, y, 100, y)
shp.Line.DashStyle = msoLineDashDotDot
shp.Line.ForeColor.RGB = RGB(179, 254, 156)
Next i
End Sub
-------------------
Sub Macro1()
Dim shp As Shape
Set shp = _
ActiveDocument _
.Sections(1).Headers(wdHeaderFooterPrimary) _
.Shapes.AddShape( _
Type:=msoShape5pointStar, _
Left:=20, Top:=20, _
Width:=100, Height:=100)
shp.Fill.ForeColor.RGB = RGB(0, 255, 0)
End Sub
Sub Macro2()
Dim shp As Shape
Dim doc As Document
Set doc = Documents("docmacrotest")
With doc
Set shp = .Shapes.AddShape(msoShapeRectangle, 50, 50, 100, 200)
shp.Fill.ForeColor.RGB = RGB(0, 255, 0)
End With
End Sub
Sub Macro3()
Dim shp As Shape
Dim doc As Document
Dim i As Long
Dim cm As Double
Dim y As Double
cm = 72 / 2.54
For i = 11 To 20
y = CDbl(i) * cm
Set doc = Documents("docmacrotest")
Set shp = doc.Shapes.AddLine(10, y, 100, y)
shp.Line.DashStyle = msoLineDashDotDot
shp.Line.ForeColor.RGB = RGB(179, 254, 156)
Next i
End Sub
Sub Macro4()
Dim shp As Shape
Dim doc As Document
Dim i As Long, n As Long
Dim cm As Double
Dim y As Double
Set doc = Documents("docmacrotest")
n = doc.Shapes.Count
For i = 1 To n
doc.Shapes(1).Delete
Next i
End Sub
Sub Macro5()
Dim shp As Shape
Dim doc As Document
Dim i As Long
Dim cm As Double
Dim y As Double, x As Double, x2 As Double, y2 As Double
Dim xx As Single, xx2 As Single, yy As Single, yy2 As Single
Set doc = Documents("test")
cm = 72 / 2.54
x = (2.2) * cm
x2 = (2.2 + 16.6) * cm
For i = 0 To 37
y = (2.2 + CDbl(i) * (19.5 / 37)) * cm
xx = CSng(x): yy = CSng(y): xx2 = CSng(x2): yy2 = CSng(y)
Set shp = doc.Shapes.AddLine(CSng(x), CSng(y), CSng(x2), CSng(y))
shp.Line.DashStyle = msoLineDashDotDot
shp.Line.ForeColor.RGB = RGB(179, 254, 156)
Next i
y = 2.2 * cm
y2 = (2.2 + 19.5) * cm
For i = 0 To 53
x = (2.2 + CDbl(i) * (16.6 / 53)) * cm
Set doc = Documents("docmacrotest")
Set shp = doc.Shapes.AddLine(CSng(x), CSng(y), CSng(x), CSng(y2))
shp.Line.DashStyle = msoLineDashDotDot
shp.Line.ForeColor.RGB = RGB(179, 254, 156)
Next i
End Sub
------------------------------------------------------
Sub Macro1()
Dim shp As Shape
Set shp = _
ActiveDocument _
.Sections(1).Headers(wdHeaderFooterPrimary) _
.Shapes.AddShape( _
Type:=msoShape5pointStar, _
Left:=20, Top:=20, _
Width:=100, Height:=100)
shp.Fill.ForeColor.RGB = RGB(0, 255, 0)
End Sub
Sub Macro2()
Dim shp As Shape
Dim doc As Document
Set doc = Documents("docmacrotest")
With doc
Set shp = .Shapes.AddShape(msoShapeRectangle, 50, 50, 100, 200)
shp.Fill.ForeColor.RGB = RGB(0, 255, 0)
End With
End Sub
Sub Macro3()
Dim shp As Shape
Dim doc As Document
Dim i As Long
Dim cm As Double
Dim y As Double
cm = 72 / 2.54
For i = 11 To 20
y = CDbl(i) * cm
Set doc = Documents("docmacrotest")
Set shp = doc.Shapes.AddLine(10, y, 100, y)
shp.Line.DashStyle = msoLineDashDotDot
shp.Line.ForeColor.RGB = RGB(179, 254, 156)
Next i
End Sub
Sub Macro4()
Dim shp As Shape
Dim doc As Document
Dim i As Long, n As Long
Dim cm As Double
Dim y As Double
Set doc = Documents("docmacrotest")
n = doc.Shapes.Count
For i = 1 To n
doc.Shapes(1).Delete
Next i
End Sub
Sub Macro5()
Dim shp As Shape
Dim doc As Document
Dim i As Long
Dim cm As Double
Dim y As Double, x As Double, x2 As Double, y2 As Double
Dim xx As Single, xx2 As Single, yy As Single, yy2 As Single
Set doc = Documents("test")
cm = 72 / 2.54
x = (2.2) * cm
x2 = (2.2 + 16.6) * cm
For i = 0 To 37
y = (2.2 + CDbl(i) * (19.5 / 37)) * cm
xx = CSng(x): yy = CSng(y): xx2 = CSng(x2): yy2 = CSng(y)
Set shp = doc.Shapes.AddLine(CSng(x), CSng(y), CSng(x2), CSng(y))
shp.Line.DashStyle = msoLineDashDotDot
shp.Line.ForeColor.RGB = RGB(179, 254, 156)
Next i
y = 2.2 * cm
y2 = (2.2 + 19.5) * cm
For i = 0 To 52
Rem x = (2.2 + CDbl(i) * (16.6 / 52)) * cm
x = (2.2 + CDbl(i) * (16.51 / 52)) * cm
Set shp = doc.Shapes.AddLine(CSng(x), CSng(y), CSng(x), CSng(y2))
shp.Line.DashStyle = msoLineDashDotDot
shp.Line.ForeColor.RGB = RGB(179, 254, 156)
Next i
End Sub