Private Sub CommandButton13_Click()
Dim FigRef As String
Dim IndFRef As String
Dim TitD As String
Dim LODoc As String
Dim CF As Integer
For Each aVar In ActiveDocument.Variables
If aVar.Name = "TitDoc" Then CF = aVar.Index
Next aVar
If CF = 0 Then
MsgBox ("No existe el titulo del documento, primero debe ingresar este parametro")
Else
TitD = ActiveDocument.Variables("TitDoc").Value
FigRef = InputBox("ATENCION¡ Al ingresar el nombre de la figura, deje dos espacios en blanco despues ingrese el nombre de la figura: Ejemplo (Vacio 2 tabulaciones)Indicadores de contaminaciòn ")
ActiveDocument.Shapes.AddShape(msoShapeRectangle, 464, _
640, 85, 27).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
On Error GoTo Insertar:
Inicio:
Selection.InsertCaption Label:="Figura", TitleAutoText:="", Title:="", _
Position:=wdCaptionPositionBelow, ExcludeLabel:=0
GoTo Siguiente
Insertar:
CaptionLabels.Add Name:="Figura"
GoTo Inicio
Siguiente:
Selection.TypeText Text:=FigRef
Selection.ShapeRange.Select
Selection.Font.Size = 12
Selection.Font.Name = "Arial"
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Font.Color = wdColorBlack
' EL ERROR ES AQUI, PUES EL PRIMER RECUADRO LO PONE EN LA HOJA QUE QUIERO, LOS OTROS SE PASAN AL MARCO ANTERIOR
ActiveDocument.Shapes.AddShape(msoShapeRectangle, 50, 70, 515#, _
550).Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.ForeColor.ObjectThemeColor = wdThemeColorText1
Selection.ShapeRange.Line.ForeColor.TintAndShade = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Weight = 1#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Style = msoLineSingle
ActiveDocument.Shapes.AddShape(msoShapeRectangle, 68, _
640, 381.75, 42.75).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.TypeText Text:=TitD
Selection.WholeStory
Selection.Font.Italic = wdToggle
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Font.Name = "Arial"
Selection.Font.Size = 10
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.ForeColor.ObjectThemeColor = wdThemeColorText1
Selection.ShapeRange.Line.ForeColor.TintAndShade = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Weight = 1#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Style = msoLineSingle
IndFRef = FigRef
' ActiveDocument.Shapes.AddShape(msoShapeRectangle, 93.6, 86.4, 421.7, _
' 87.45).Select
' Selection.ShapeRange.TextFrame.TextRange.Select
' Selection.Collapse
' Selection.TypeText Text:="YHYAHYAHAYAHAYHAYAHAY"
ActiveDocument.Shapes.AddShape(msoShapeRectangle, 68, _
690, 381.75, 21.75).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.TypeText Text:=IndFRef
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.ForeColor.ObjectThemeColor = wdThemeColorText1
Selection.ShapeRange.Line.ForeColor.TintAndShade = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Weight = 1#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.WholeStory
Selection.Font.Name = "Arial"
Selection.Font.Size = 10
ActiveDocument.Shapes.AddShape(msoShapeRectangle, 53, 629, 509, _
97).Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.ForeColor.ObjectThemeColor = wdThemeColorText1
Selection.ShapeRange.Line.ForeColor.TintAndShade = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Weight = 1#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Style = msoLineSingle
Call Insertalogo
ActiveDocument.Shapes.AddShape(msoShapeRectangle, 50, 626#, 515#, _
103#).Select
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.ForeColor.ObjectThemeColor = wdThemeColorText1
Selection.ShapeRange.Line.ForeColor.TintAndShade = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Weight = 1#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.Style = msoLineSingle
End If
MACRO_PRIN.Hide
Unload MACRO_PRIN
End Sub