Adding a line of code to a macro to strip Quotes from the text file created

DeeJay*123

New Member
Joined
Dec 10, 2012
Messages
21
Hello - I have, with the expert assistance from a user here, the following code. I need to, however strip the text file it creates of the " marks Excel has decided to add in before I close the file created. Does anyone know how to accomplish this by possibly adding a line of code in?

I think I would be able to accomplish this step if I were recording the macro but I still don't know how to translate my recorded code over to the written code. It doesn't seem to cut/paste over seamlessly and me, not knowing VBA, am at a loss. :confused:



Sub CreateCodeandSave()
'
' CreateCodeandSave Macro
'
' Keyboard Shortcut: Ctrl+Shift+E
'
Application.DisplayAlerts = False
Sheets("CONCATS AND TIME VALUES").Range("H4").Value = Sheets("CONCATS AND TIME VALUES").Range("G4").Value
Sheets("CONCATS AND TIME VALUES").Range("H6").Value = Sheets("CONCATS AND TIME VALUES").Range("B6").Value
Sheets("CONCATS AND TIME VALUES").Range("H6").NumberFormat = "[$-409]m/d/yy h:mm AM/PM;@"
Sheets("CONCATS AND TIME VALUES").Range("H8").Value = Sheets("CONCATS AND TIME VALUES").Range("G8").Value
Sheets("CONCATS AND TIME VALUES").Range("H12").Value = Sheets("CONCATS AND TIME VALUES").Range("G12").Value
'Sets variable that holds the new filename
Dim NewFileName As String
NewFileName = Sheets("Result").Range("A7").Value
Sheets("Result").Range("A1:A2").Copy
Workbooks.Add
ActiveWorkbook.ActiveSheet.Paste Destination:=Worksheets(1).Range("A1:A2")
Application.CutCopyMode = False
'Turns the copied cells into values
Range("A1:A2").Value = Range("A1:A2").Value
ChDir "Z:\ISGDemandManagement"
ActiveWorkbook.SaveAs Filename:="Z:\ISGDemandManagement\" & NewFileName & ".txt", FileFormat:=xlText, CreateBackup:=False
'I BELIEVE HERE I NEED TO STRIP THE TEXT FILE JUST CREATED OF THE " MARKS, & SAVE AGAIN
ActiveWindow.Close
Sheets("Input and Execute").Select
Application.DisplayAlerts = True
MsgBox "Done!"
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top