Caros estava usando este código para salvar um arquivo txt...agora alterei meu excel para 2010, e não estou mais conseguindo salvar o txt...ele vai até na hora de salvar e da erro...alguém pode me ajudar??
Att
Private Sub CommandButton1_Click()
Dim sTEXT As String
Dim X As Integer
Set wsMenu = ActiveWorkbook.ActiveSheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
sTEXT = Range("vHeadText")
' On Error GoTo ErrHand1:
sActPath = Range("vPathAC")
If Right(sActPath, 1) <> "" Then sActPath = sActPath & ""
sActFile = Range("vNameAC01")
If Dir(sActPath, vbDirectory) = "" Then
MsgBox "The selected folder is incorrect!"
Exit Sub
End If
Worksheets.Add
ActiveSheet.Name = "tmpRace"
sActPath_File = sActPath & sActFile
iTmp = 1
If CheckBox1 Then mReadWs Range("_rSN1")
If CheckBox2 Then mReadWs Range("_rSN2")
If CheckBox3 Then mReadWs Range("_rSN3")
If CheckBox4 Then mReadWs Range("_rSN4")
If CheckBox5 Then mReadWs Range("_rSN5")
If CheckBox6 Then mReadWs Range("_rSN6")
If CheckBox7 Then mReadWs Range("_rSN7")
If CheckBox8 Then mReadWs Range("_rSN8")
If CheckBox9 Then mReadWs Range("_rSN9")
If CheckBox10 Then mReadWs Range("_rSN10")
If CheckBox11 Then mReadWs Range("_rSN11")
If CheckBox12 Then mReadWs Range("_rSN12")
If CheckBox13 Then mReadWs Range("_rSN13")
If CheckBox14 Then mReadWs Range("_rSN14")
If CheckBox15 Then mReadWs Range("_rSN15")
If CheckBox16 Then mReadWs Range("_rSN16")
If CheckBox17 Then mReadWs Range("_rSN17")
If CheckBox18 Then mReadWs Range("_rSN18")
If CheckBox19 Then mReadWs Range("_rSN19")
If CheckBox20 Then mReadWs Range("_rSN20")
If CheckBox21 Then mReadWs Range("_rSN21")
If CheckBox22 Then mReadWs Range("_rSN22")
If CheckBox23 Then mReadWs Range("_rSN23")
If CheckBox24 Then mReadWs Range("_rSN24")
If CheckBox25 Then mReadWs Range("_rSN25")
If CheckBox26 Then mReadWs Range("_rSN26")
If CheckBox27 Then mReadWs Range("_rSN27")
If CheckBox28 Then mReadWs Range("_rSN28")
If CheckBox29 Then mReadWs Range("_rSN29")
If CheckBox30 Then mReadWs Range("_rSN30")
Sheets("tmpRace").Select
Sheets("tmpRace").Cells.Copy
Sheets("tmpRace").Cells(1, 1).Select
Workbooks.Add
Selection.PasteSpecial xlValues, xlNone, False, False
ActiveSheet.Rows("1:1").Insert xlDown
ActiveSheet.Range("A1").FormulaR1C1 = sTEXT
ActiveWorkbook.SaveAs sActPath_File, xlTextPrinter, False
ActiveWindow.Close
Worksheets("tmpRace").Delete
wsMenu.Select
MsgBox "The file is saved! (" & sActPath & sActFile & ")"
Exit Sub
ErrHand1:
If Err = "68" Then
Range("vPath").Select
MsgBox Error(Err), vbOKOnly, "Error"
Else
MsgBox Error(Err), vbOKOnly, "Error"
On Error Resume Next
Worksheets("tmpRace").Delete
wsMenu.Select
End If
End Sub
Postado : 06/12/2012 1:21 pm