Edit Change And Output A Text File

Feb 7, 2009

I use excel to read in an ASCII data file in which every line beginning with H is a header line and lines beginning with S are data line.

I want excel to filter out the header lines and output the file with the data lines only then outputs these in a new file.

I also want it to read the values from column 72 to 75 and subtract 6 from them then output them again to the same new file.

Sub read()
Open "d:/intouch/0502SPSS.LOG" For Input As #1
Dim i As Integer
Dim lines(9999) As String
i = 0
Do While Not EOF(1)
Line Input #1, z
i = i + 1
If Mid(z, 1, 1) = "H" Then
i = i - 1

ElseIf Mid(z, 1, 1) = "S" Then.................................

the problem is that the new file is generated but it is always empty

View 9 Replies


ADVERTISEMENT

Macro To Edit Text File

Dec 7, 2007

I was wondering if it was possible for a macro to edit a file by opening each .txt file, searching for the word "Reference", and then replace it with the word "Ref". Then save and close the text file.

There are no delimiters in the text files.

View 9 Replies View Related

Output Redirection From BAT Or VBS To Text File

Jun 26, 2014

I am working on a VBA routine that calc and verifies hash files for a series of folders and sub directories, using a command line prog called exactfile.exe (exactfile.com). It is very similar to M$'s FCIV utility, but it is actually supported on Win7/Win8. The issue I am having is that I cannot get the standard output/error/console stream to redirect to a text file. I've written the routine multiple ways, trying to figure out redirection. I was using this site

HTML Code: [URL]....

as a reference.

Here is my VBS approach. This code is dependent on another sub passing folder_name as a string

[Code] .....

The VBS then executes using wscript, however, since exf.exe does not return an exit code the same way FCIV.exe does, I need the results redirected to a text file. The results vary from a single line saying "No errors." or multiple lines indicating which files do not match their original hash.

Here are a couple iterations of my BAT approach, where i use the BAT to call the VBS. I really thought I would be able to use the standard redirect > here, since the executable is launched using cmd.exe, but I've not gotten the results I want.

[Code] .....

I've scoured more pages than I can count, but no approach seems to work, so far.

View 4 Replies View Related

Output Used Range To Text File

Oct 9, 2007

I would like to output the text I perpared in " sheet 1" into a text file, "output.txt"

The imformation I like to output start from coulmn C, and column D then column E.....
The numbers of rows in each column could be different, and also there may be some single empty column in between. The totals numbers of coulmn is unknow.

the text in the output.txt should contant all the imformation in the sheet started from column C, coulmn D, column F.... (if coulmn E is empty). and the text in the output.txt file is continues with no gap in it.

To make it even more powerful for later use, The column that begin with NOT should not be output.

Example:
Excel Data-
A____B____C____D____E____F____G____H____I____J
1a....1b.....1c.....1d............Not.....1g
................2c.....2d............2f......2g
........................3d............3f......3g
........................4d

output.txt-
1c
2c
1d
2d
3d
4d
1g
2g
3g

View 4 Replies View Related

Macro To Access/edit/save A Text File

Apr 21, 2008

I have an xl doc in which one of the sheet's column A changes value every 1 hour...

What I would like to know is.. if there is a method in which i can copy these values from column A to a text file every hour...

The range of cells containing values in Column A also varies every hour.

Also, the old values in the text file needs to get deleted before the new values are updated every hour.

View 14 Replies View Related

Output To CSV Text File Produces Extra Spaces

May 21, 2008

I'm outputting some cells to a CSV. At first I tried using the SaveAs function but that renamed my worksheet and didn't work for ranges (as far as I know)

Sub Export()
'Set myADPFile = "C:ADPPCPWADPDATAPRSHWEPI.CSV"
Dim myADPFile As String
myADPFile = "C:PRSHWEPI.CSV"
Dim x As Byte
x = 5
Open myADPFile For Output As 1
While (Not (Sheet3.Range("A" & x).Value = NA))
Print #1, Trim(Sheet3.Range("B" & x).Value), ",", _
Trim(Sheet3.Range("C" & x).Value), ",", _
Sheet3.Range("D" & x).Value, ",", _ ..........................

The values are correct. However, the excess amount of spaces is not. Using the Write function just encases everything in quotation marks. Replacing spaces isn't a good solution because the first row MUST be in that format, and removing all spaces would require more code to put spaces back in. Is there a way to get rid of all the excess spaces surrounding each value?

View 2 Replies View Related

Excel Macro To Output Text File After Global Find And Replace

May 19, 2014

See attached image.

So what I am looking for is to put a macro behind button 1 which will do the following

Enter A Default Value Of 123 In The Yellow Boxes (B7:K7)
If They Are Blank When The User Clicks The Button
Performs A Search And Replace To Replace The Values 01-01-1990 With B8, 02-01-1990 With C8 Etc Until K8
Output The Contents Of Sheet 2 To A Text File (In XAI Format) In The Following Order A1:A100, B1:B100, C1:C100

[Code] .........

View 1 Replies View Related

Modify/Edit File Properties Of CSV File

Jun 9, 2008

I need to modify/edit the properties of a CSV File. (Ex: Title, Subject, Author, Category, Keywords, Comments) through VBA

View 5 Replies View Related

How To Change Line When Writing To Text File

Feb 9, 2012

Set FSO = New FileSystemObject
Set FSOFile = FSO.OpenTextFile(textfullname, 2, True)
FSOFile.Write ("xx")
FSOFile.Write ("02022012")
FSOFile.Writeline ("Next line")

I am getting this in the text file:- xx02022012Next line

I want this: xx02022012 Next line

How to change line when writing to a text file?? the writeline is not changing line.

View 1 Replies View Related

Change Characters In Specific Position Of A Text File

Aug 6, 2008

I have a very large file of data, over 500,000 rows, opening in one sheet in Excel is not an option with my current version. In each row I need to change the characters in positions 41-44 from whatever they current are, to '9999'. I'm sure there has to be a way I can do this using vba, does anyone have a sample snippet of code, or another post they can point me too?

View 9 Replies View Related

Change Output To Percentage?

Nov 27, 2013

i have the formula below,

currently the output is comming as a number but i need the output to come has a percentage what adjustments do i need to make to do this?

=CHAR(149)&" "&"The overall YTD"&" "&"performance is"&('Red Activity & Performance'!R45)*100&IF(INDEX('Red Activity & Performance'!R45:R55,MATCH("Red 1 8min",'Red Activity & Performance'!$A$45:$A$55,0),MATCH("YTD",'Red Activity & Performance'!$R$44,0))<INDEX('Red Activity & Performance'!$C$45:$C$55,MATCH("Red 1 8min",'Red Activity & Performance'!$A$45:$A$55,0)),"Is below the target (75%) by: "&TEXT(INDEX('Red Activity & Performance'!$A$45:$A$55,MATCH("Red 1 8min",'Red Activity & Performance'!$A$45:$A$55,0))-INDEX('Red Activity & Performance'!$R$44,MATCH("Red 1 8min",'Red Activity & Performance'!$A$45:$A$55,0),MATCH("YTD",'Red Activity & Performance'!$R$44,0)),"0%"),"has achieved the national target (75%)")

View 5 Replies View Related

Edit BAT File In Using VBA?

Jan 21, 2013

Is it possible to edit my .bat file using vba?

View 1 Replies View Related

Edit/change A Formula In A Cell Using VBA

Sep 17, 2008

How to edit a formula in a cell using vba code.
For example, the cell A1 in sheet "sheet1" contains formula "=sum(Sheet2!B1+Sheet3!B1)" and I would like to use VBA to edit/change it to "=sum(Sheet2!B1+Sheet3!B1+Sheet4!B1+Sheet5!B1)" and so on

View 9 Replies View Related

Detect Change Or Edit In Textbox

Jan 1, 2007

I need to detect when changes are made to a TextBox (Manual changes). In VB 'TextChanged' fulfills that function but there is no equivalent in VBA.

I also need to differentiate between adding a value to a TextBox which has a vbnull value (Does not need to trigger event) and editing or replacing the current TextBox value (Trigger an event).

View 6 Replies View Related

Change/Edit External Links

Dec 12, 2007

Is it possible to update external links on a worksheet via running a macro?
I have a worksheet where some cells have external links to other files, and every month I have to scroll through and do the typing in order to have everything up and running.
A typical cell has formulas like =[E:ReportsAug-2007.xls]Data!F25
Another cell =[E:ReportsAug-2007.xls]Data!F43
and so on.

Every new month I actually have to replace all [E:ReportsAug-2007.xls] occurrences with for example [E:ReportsSep-2007.xls]. So, is it possible to have a macro which opens a textbox of which i can type the new month 'Sep', so that when the macro runs I save all the typing?

View 3 Replies View Related

CSV FILE Output

Aug 12, 2008

I am making a report that puts out a CSV file my trouble is that some of the numbers are converted to date when they are opened in excel. This report is sent out company wide and I need a way to keep the numbers from changing to date. I have added a tic(') mark to the front of the number but it comes over as '12308. What can I do.

View 9 Replies View Related

Output Csv File

Jul 1, 2006

I'm wondering if it's possible to use a button in excel where I can output a cvs file (from another sheet in the file) with just a click on that button.

View 3 Replies View Related

Change Negative Output Of IF Statement?

Nov 21, 2013

I have created the If statement below, in a nutshell its comparing current month performance to last month, stating if it has increased or decreased by last month and how much percentage by

example output would be 'This has decreased by x%"

my problem is when it states the performance has increased , the x% is coming as a negative number (-x%)

what can I do to change this to positive?

Below is the formula

=IF(INDEX('Red Activity & Performance'!$E$45:$J$45,MATCH(PERFORMANCE!$AK$31,'Red Activity & Performance'!$E$44:$J$44,0))

View 7 Replies View Related

Change The Date By Hitting Th Edit Button

Jan 31, 2007

I have this data from a sheet in date format in cell "A1". i retrieve the value of the date in a textbox. TextBox1.Value = Range("A1").Value then i wanted to change the date by hitting th edit button

private sub CommandButton1_Click()
DTPicker.Value = Range("A1").Value
End Sub

after changes have made, button save is clicked and at the same time the value from DTPicker is send to cell "A1", the value is retrieve back into TextBox1

private sub CommandButton2_Click()
Range("A1").Value = DTPicker.Value
TextBox1.Value = Range("A1").Value
End Sub

don't know what happen suddenly the value inside the cell become 12:00:00 AM, while the actual value that were supposed to be in that cell and textbox is 12/1/1999 - which is 12th of january 2001

View 5 Replies View Related

Save Output To A .txt File

Apr 23, 2006

I have a text file output from a program that is named “ABC123.exp”. I open up the file with Excel and after manipulating the data with VBA code which includes identifying the Source Path directory(strSourcePath As String ) and the File name (strFileName As String) I want to be able to open up a 'Save As' Window and save the manipulated data into the same Source Path directory(strSourcePath) with the File Name being the prefix of the original with a suffix .txt extension. Ex: “ABC123.txt” instead of “ABC123.exp” and the Save as type: Text (Tab delimited)(*.txt). This way my original data won’t be overwritten.

View 5 Replies View Related

Change Output Of Option Button To Caption Or Name

Jan 11, 2008

I'm a complete Excel and VBA newbie and would like to know if it's possible to change the output of OptionButtons from 'TRUE' or 'FALSE' to "1"/"2"/"3"/etc..

The name of each button is:

Rating 1
Rating 2
Rating 3
Rating 4
and so forth..


The idea is for each rating to output its assigned number such that if the user were to click "Rating 1", the result would be "1", "Rating 2" = 2 and so on. I'm trying to design a survey and these results will then be used to calculate an average rating. If this is possible, how would I need to write the code for it?

View 2 Replies View Related

VLook Up Specific Text Within Text And Output Match From Table

Dec 3, 2009

Table 1:
I like to go to Berlin.
You like to move to Amsterdam.
They want to see Chicago.
When will the reach San Francisco.

Table 2:
Amsterdam
Chicago
San Francisco
Berlin

What I want to do:
I want my function to see if the text in Table 1 contains a value in Table 2, and if yes, output that value.

Desired Result:

Row A1:
I like to go to Berlin.
Row A2:
Berlin
Row B1:
You like to move to Amsterdam.
Row B2:
Amsterdam

View 9 Replies View Related

Output Property To Save As File

Jun 5, 2006

I'm trying to display some result in my sheet and I don't go further of the MsgBOx use. see my vba code

Dim xslt As New MSXML2.XSLTemplate40
Dim xslDoc As New MSXML2.FreeThreadedDOMDocument40
Dim xmlDoc As New MSXML2.DOMDocument40
Dim xslProc As IXSLProcessor
Dim paramxml As MSXML2.DOMDocument40
xslDoc.async = False
xslDoc.Load "c:compara.xsl"

If (xslDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xslDoc.parseError
MsgBox ("Ha um erro " & myErr.reason)
Else
Set xslt.stylesheet = xslDoc
xmlDoc.async = False
xmlDoc.Load "C:Instructional_program.xml".................

View 2 Replies View Related

Parse An Output File From X-12-arima Using Vba

Jul 10, 2006

I'm trying to parse an output file from x-12-arima using vba. The file is in this format

.....
invalidate the results of this test For the last three year period.
ICMETI, Total Inventories Communications Equipment PAGE 9, SERIES foo

D 12 Final trend cycle
From 2002.Jan To 2005.Dec
Observations 48
Trend filter 13-term Henderson moving average
I/C ratio 1.08 .............

View 5 Replies View Related

Prevent Users From Edit/change Formats Of Unlocked Cells

Sep 30, 2007

I have a spreadsheet that is very large and formated a certain way. I want to make sure that a user cant put the cursor in the lower left corner and copy cells by dragging, copy & paste, or do anything other than input data and be able to highleght text and reinput data in case they mistyped or misspelled the data.

ex: user clicks on cell E33 and types in '1234568' and then move to next cell. The user can click back on E33 and can correct by retyping. That is all the user is allowed.
The cells in question are also in ranges if this helps. EX: 'E33:AJ67'

View 9 Replies View Related

Can't Edit File That Opens In Protected View Mode

Apr 12, 2013

A client has sent me an Excel workbook that appears on the screen with the message adivising that it is Protected View as a result of having been downloaded from the internet. If I click on the Enable Editing button the workbook is completely deactivated. I have played around with my Trust Centre settings but nothing seems to work.

View 1 Replies View Related

Edit Macro To Open Specific File Automatically

Aug 16, 2007

I am using this code to get me to a path then I click on the file I want and it opens it and makes it a .csv file. Then my code does stuff with it and closes it. My question is, do I even have to click on it? Can I get the macro to automatically open the file. Note the "NewestFolderInThePath" is a function that open me up to the "newest" created folder in the path. From there I double click file.

NewestFolderInThePath = ReturnNewestFolder("\datawhse
ootLAW81LAWSONprintRBLEVINS2anrvwfins1")
Path = "\datawhse
ootLAW81LAWSONprintRBLEVINS2anrvwfins1"

TheFile = Path & NewestFolderInThePath
CreateObject("WScript.Shell").CurrentDirectory = TheFile

TheFile = Application.GetOpenFilename("Excel Files (*.*), *.*", , "Open Balance Sheet File FRPMBSDTL")
If TheFile = "False" Then
continue = MsgBox("Do you want to Continue to IS Download?", _................

View 9 Replies View Related

Ranking Program: Edit Formulas Under The Mon-D15 Worksheet In This File

Apr 27, 2006

I am trying to edit some formulas Under the Mon-D15 worksheet in this file. The # NUM is where I am having trouble. Basically, what I want to do is only rank the names in C15:C18. I was successful in doing this with C10:C14. But, for some reason it will not work with the lower values.

Question #2
Is there a way to make Columns I:O stay static through Rows 1:24 (width=3)?
I want Rows 25:40 to be different widths (width=2) in Columns I:O.

View 3 Replies View Related

Modify/Edit File Properties (Date Modified) Of Workbook

Apr 8, 2008

I want to amend the ' Date Modified' for a spreadsheet. I have just made changes to it - so the 'Date Modified' shows today's date and time. Is there a way of changing the 'Date Modified' so it shows as yesterday's date?

View 3 Replies View Related

Loop Through Rows With VBA And Select Output File With Selectable Dates

Apr 9, 2014

I have developed a user form in VBA which is used for entry into an excel worksheet. From this data, I need to do the following:

1) Create 2 output files for Job data entitled "J" and another file entitled "S". The "J" and "S" is captured in a field in the data. I need to hit a button that allows these 2 output files to be produced, so I need to 'loop' through rows of the data to do this/

2) In addition to 1), the user needs to be able to 'select' the date range they would like to see 'J' and 'S' data over. This will be based on a field called "Startdate'. How could I do this with the button above-can I parse an input value to a form and select the 'J' and 'S' files on this.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved