Macro estropeada de word
Publicado por Rafa (1 intervención) el 14/11/2007 11:50:35
Hola, me metí en una macro a intentar copiarla a otro ordenador y sin querer me la cargué a medias, no tengo ni idea de como va, pero me es muy necesaria para el trabajo, si alguien pudiese faciliarme una similar, o arreglar lo que queda de ella le estaría muy agradecido.
PD. La forma de instalarla tb me sería útil pq no se exactamente como se hace.
Gracias anticipadas, esto es lo que quedó de la macro: no se si hay algo repetido, y creo que me cargué algo al comienzo.
'Quita espacios
With Rango.Find
.Text = " "
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Coloca fuente
With Rango.Font
.Name = "Courier New"
.Size = 10
End With
'Quita Intros
With Rango.Find
.Text = ChrW(13)
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Si es un intro mira el caracter anterior y si es " " lo borra
If Rango.Text = ChrW(13) Then
If Left$(Rango.Text, 1) = " " Then
Rango.Start = Rango.Characters.Count - 1
Rango.Text = ""
End If
End If
'Quita Intros
With Rango.Find
.Text = ChrW(11)
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita guiones
With Rango.Find
.Text = "-"
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita puntos "..."
With Rango.Find
.Text = "..."
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita puntos ".."
With Rango.Find
.Text = ".."
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
ThisDocument.JustificationMode = wdJustificationModeCompress
x = x + 1
Loop While x < 10
Rango.Copy
End Sub
Sub Macro2()
'
' Macro2 Macro
' Macro grabada el 02/07/2007 por registro
'
CommandBars("Stop Recording").Visible = False
ChangeFileOpenDirectory "\\P125\sonia\"
ActiveDocument.SaveAs FileName:="división.rtf", FileFormat:=wdFormatRTF, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ActiveWindow.Close
End Sub
Sub Macro100()
Sub Formato()
' Formato Macro
Dim x As Integer
x = 0
Do
Set Rango = ActiveDocument.Range()
'Quita espacios
With Rango.Find
.Text = " "
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Coloca fuente
With Rango.Font
.Name = "Courier New"
.Size = 10
End With
'Quita Intros
With Rango.Find
.Text = ChrW(13)
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Si es un intro mira el caracter anterior y si es " " lo borra
If Rango.Text = ChrW(13) Then
If Left$(Rango.Text, 1) = " " Then
Rango.Start = Rango.Characters.Count - 1
Rango.Text = ""
End If
End If
'Quita Intros
With Rango.Find
.Text = ChrW(11)
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita guiones
With Rango.Find
.Text = "-"
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita puntos "..."
With Rango.Find
.Text = "..."
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita puntos ".."
With Rango.Find
.Text = ".."
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
ThisDocument.JustificationMode = wdJustificationModeCompress
x = x + 1
Loop While x < 10
Rango.Copy
End Sub
PD. La forma de instalarla tb me sería útil pq no se exactamente como se hace.
Gracias anticipadas, esto es lo que quedó de la macro: no se si hay algo repetido, y creo que me cargué algo al comienzo.
'Quita espacios
With Rango.Find
.Text = " "
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Coloca fuente
With Rango.Font
.Name = "Courier New"
.Size = 10
End With
'Quita Intros
With Rango.Find
.Text = ChrW(13)
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Si es un intro mira el caracter anterior y si es " " lo borra
If Rango.Text = ChrW(13) Then
If Left$(Rango.Text, 1) = " " Then
Rango.Start = Rango.Characters.Count - 1
Rango.Text = ""
End If
End If
'Quita Intros
With Rango.Find
.Text = ChrW(11)
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita guiones
With Rango.Find
.Text = "-"
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita puntos "..."
With Rango.Find
.Text = "..."
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita puntos ".."
With Rango.Find
.Text = ".."
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
ThisDocument.JustificationMode = wdJustificationModeCompress
x = x + 1
Loop While x < 10
Rango.Copy
End Sub
Sub Macro2()
'
' Macro2 Macro
' Macro grabada el 02/07/2007 por registro
'
CommandBars("Stop Recording").Visible = False
ChangeFileOpenDirectory "\\P125\sonia\"
ActiveDocument.SaveAs FileName:="división.rtf", FileFormat:=wdFormatRTF, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ActiveWindow.Close
End Sub
Sub Macro100()
Sub Formato()
' Formato Macro
Dim x As Integer
x = 0
Do
Set Rango = ActiveDocument.Range()
'Quita espacios
With Rango.Find
.Text = " "
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Coloca fuente
With Rango.Font
.Name = "Courier New"
.Size = 10
End With
'Quita Intros
With Rango.Find
.Text = ChrW(13)
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Si es un intro mira el caracter anterior y si es " " lo borra
If Rango.Text = ChrW(13) Then
If Left$(Rango.Text, 1) = " " Then
Rango.Start = Rango.Characters.Count - 1
Rango.Text = ""
End If
End If
'Quita Intros
With Rango.Find
.Text = ChrW(11)
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita guiones
With Rango.Find
.Text = "-"
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita puntos "..."
With Rango.Find
.Text = "..."
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'Quita puntos ".."
With Rango.Find
.Text = ".."
.ClearFormatting
.Replacement.Text = " "
.Replacement.ClearFormatting
.Execute Replace:=wdReplaceAll, Forward:=True
End With
ThisDocument.JustificationMode = wdJustificationModeCompress
x = x + 1
Loop While x < 10
Rango.Copy
End Sub
Valora esta pregunta


0