Ciao a tutti
sto impazzendo dietro ad una maledetta Macro di Excel. La macro che vi allego legge un file da un sito internet, toglie un po di colonne e reighe che non servono e poi salva il file cosi ripulito con un nome. Poi l'applicazione si chiude. Anzi dovrebbe chiudersi ma non succede nulla ! Il file di excel viene chiuso ma Excel è sempre aperto
L'istruzione Application.Quit l'ho già usata svariate volte. Non capisco perché ora non funziona.
Ho fatto un pò di prove e ho visto che se tolgo l'istruzione per Salvare il file nel nuovo formato, l'istruzione fa terminare l'applicazione. Ma ovviamente a me serve !!!
Mi date un mano ?
Sub puliscitutto()
'
' puliscitutto Macro
' Macro registrata il 24/09/2007 da WinXp
'
'
ActiveSheet.Shapes("Picture 41").Select
Selection.Delete
Cells.Select
Selection.ClearFormats
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Rows("1:21").Select
Selection.Delete Shift:=xlUp
Columns("J:O").Select
Selection.Delete Shift:=xlToLeft
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
ActiveWindow.SmallScroll Down:=-21
Columns("B:B").EntireColumn.AutoFit
ActiveWindow.SmallScroll ToRight:=1
Columns("B:B").ColumnWidth = 63.29
Columns("C:G").Select
Selection.Delete Shift:=xlToLeft
Range("B7").Select
ActiveWindow.SmallScroll Down:=-15
Columns("B:B").EntireColumn.AutoFit
ActiveWindow.SmallScroll Down:=162
Cells.Select
Selection.Replace What:=",", Replacement:="-", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="10+", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="n.d.", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="tel.", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("B1").Select
ActiveWorkbook.SaveAs Filename:= _
"x:\importazione\articoli.csv", FileFormat:=xlCSVMSDOS, _
CreateBackup:=False
ActiveWorkbook.Save
ActiveWindow.Close 1
Application.Quit
End Sub