Sub TuttaTabella()
'COPIA SIA l' IntestazionE CHE I DATI
Dim mioWord As New Word.Application
Dim ultima_riga As Long
mioWord.Visible = True
mioWord.Documents.Open "C:Documents and Settingsx880588DesktopB.doc"
Dim mioDoc As Document
Set mioDoc = mioWord.Documents(1)
Set Tabella = mioDoc.Tables(1)
Dim Riga As Row, Cella As Cell, Valore As String
Dim i As Integer, j As Integer
For Each Riga In Tabella.Rows
i = i + 1
For Each Cella In Riga.Cells
j = j + 1
Valore = Cella.Range
Valore = Left(Valore, Len(Valore) - 2) '(2)
If Right(Valore, 1) = "%" Then
Valore = Left(Valore, Len(Valore) - 1)
End If
If IsNumeric(Valore) Then
If InStr(1, Valore, ",") Then
Mid(Valore, InStr(1, Valore, ",")) = "."
End If
Range("A1")(i, j).Value = Val(Valore)
Else
Range("A1")(i, j).Value = Valore
End If
Next
j = 0
Next
' Adatta larghezza colonne
With Range("A1")
Range(.Cells(1, 1), .End(xlToRight)).Columns.AutoFit
End With
mioDoc.Close
mioWord.Quit
Set mioWord = Nothing
End Sub
|