I am trying to develop a small personal project related to Excel.
I have developed a macro that will create a word file, with the following code.
Select Code copy to clipboard
Dim datos(0 To 1, 0 To 600) As String '(columna,fila)
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False
patharch = ThisWorkbook.Path & "\plantilla.dotx"
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Add Template:=patharch, NewTemplate:=False, DocumentType:=0
Count = 19
aux = 0
aux1 = 0
For j = 0 To 1
For k = 0 To 1200
If Hoja5.Cells(k + 1, Count) <> "" Then
datos(aux, aux1) = Hoja5.Cells(k + 1, Count)
aux1 = aux1 + 1
End If
Next k
Count = Count - 1
k = 0
aux = aux + 1
aux1 = 0
Next j
For I = 0 To UBound(datos, 2)
textobuscar = datos(0, I)
objWord.Selection.Move 6, -1
objWord.Selection.Find.Execute FindText:=textobuscar
If IsNumeric(textobuscar) = False Then
While objWord.Selection.Find.found = True
objWord.Selection.Text = datos(1, I) 'texto a reemplazar
objWord.Selection.Move 6, -1
objWord.Selection.Find.Execute FindText:=textobuscar
Wend
End If
Next I
The data that will be in datos are the following. The date and the numbers will be in the first column and pag_fecha_inicio in the second.
miércoles, 02 de marzo de 2016 [pag_fecha_inicio]
martes, 15 de marzo de 2016 [pag_fecha_fin]
395.500 [pag_promedio_diario_]
555.200 [pag_promedio_diario_mobile]
1.045.400 [pag_promedio_diario_entreseman]
734.700 [pag_promedio_diario_findesemana]
13.304.600 [pag_totales ]
5.537.100 [pag_totales_pc]
7.767.500 [pag_totales_mobile]
The problem comes when I export all the data to word since I want to export not just the numbers but also the point between the numbers.
I have the following formula { MERGEFIELD [pag_promedio_diario_] \# "##0,00"} to try to achieve that goal, however the result is the following «395500». Not the number 395.500. In addition, it appears the << >>.
Could someone help me?
I can't find a solution.
Thanks!!!
Miguel.
Bookmarks