excel output to notepad in incorrect format

consth21

New Member
Joined
Feb 1, 2005
Messages
25
Hello who ever's out there reading this. So, this is my problem....I have an excel spreadsheet which has TONS of data in which I need in acertain format for when I put it into notepad. I only have one column of data in excel, but the output of some of the cells is extremely long, like 2000 characters. In notepad, I am trying to have each line only about 75 characters wide and then the rest has to be put into the next row, and beginning with & and 10 spaces. Is there any way to do this with a macro? I am working in VB right now and this is one I have in order to go from excel to notepad, but is there some information I can add to make rows have certain number of characters and then the rest put in additional rows?

Sub OpNPad_Click()
'Standard Module code!

On Error GoTo Err_OpNPad_Click
ActiveSheet.Select

'Open NotePad with a data file!
'Call Shell("NOTEPAD.EXE u:\Excel\Test\Test.txt", 1)

'Open just the NotePad!
Call Shell("NOTEPAD.EXE", 1)

Exit_OpNPad_Click:
Exit Sub

Err_OpNPad_Click:
MsgBox Err.Description
Resume Exit_OpNPad_Click

End Sub


Sub myTSave()
Dim myFolder As String
'By Joe Was.
'Save Range as Text File.

ActiveSheet.Activate
'Ask user to select range for text file.
Set myRange = Application.InputBox(prompt:="Please select a range!", _
Title:="Text File Range!", Type:=8)
'Ask user for folder to save text file to.
myFolder = Application.GetSaveAsFilename(fileFilter:="Text Files (*.txt), *.txt")
'Save selected data as text file in users selected folder.
ActiveWorkbook.SaveAs Filename:=myFolder, FileFormat:=xlText, CreateBackup:=False
'Indicate save action.
MsgBox "Text File: " & myFolder & "Saved!"
'Go to top of sheet.
Range("A1").Select
End Sub

Thank you so much in advance. I need to get this done by tomorrow, so any help would be greatly appreciated. :)
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,214,784
Messages
6,121,536
Members
449,037
Latest member
tmmotairi

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