LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Unwanted spaces

Hi,

I am using the Open statement to load a file for input, and an Print#
statement to output to a different text file.

Open ("C:\Documents and Settings\millarg\Desktop\result.txt") For Output As
#2
T$ = Chr$(9)
Print #2, "Year"; T$; "Month"; T$; "Day"; T$; "Rain"; T$; "Lat"; T$;
"LongTd"

This particular part of code puts a heading line in the file. I then go on
to open the Input file, and do various tests. However, later on when I print
actual data, I get unwanted spaces between tab characters.

T$ = Chr$(9)
If Yr = MyYear And mnth = _
MyMonth And dy = MyDay Then
Print #2, Yr; T$; mnth; T$; dy; T$; Rain; T$; MyLat; T$; MyLong
Close #1
GoTo BackUp
Else: Input #1, Yr, mnth, dy, cumday, Rain, MyLat, MyLong

End If

Yet, if I test variables such as Yr, mnth or dy while code is running, there
are no spaces in these variables. But printing them, even if forcing a tab
character, results in spaces. Following si an example of an output:

Year Month Day Rain Lat LongTd
1975 12 21 152 148.10 23.95
1978 2 1 155.1 148.10 23.95
2002 1 5 198.6 148.10 23.95

When I paste it in here, there is only one character in the heading row,
equal to a tab in the original file. But there are multiple characters in
the actual data, which did not come from the original data.

Is there some way around this, or a test I can do to get rid of these
unwanted spaces? Any ideas?

--

Regards,

Glen Millar
Microsoft PPT MVP
http://www.powerpointworkbench.com/
Please tell us your ppt version, and get back to us here
Remove spaces from signature
Posted to news://msnews.microsoft.com


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unwanted spaces in merged cells ksf Excel Discussion (Misc queries) 1 April 22nd 09 03:08 AM
remove unwanted spaces? Nige Danton Excel Worksheet Functions 5 December 7th 07 01:10 PM
Deleting unwanted lead spaces throughout a worksheet Coles2020 Excel Worksheet Functions 12 September 21st 07 10:40 PM
Unwanted spaces Loren Excel Worksheet Functions 3 March 15th 07 08:24 PM
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM


All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"