Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Worked around it by converting to text and deleting leading spaces. Thanks. Interesting that an integer with a length of 4 has a string length of 5! -- 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 "Glen Millar" <glen @ powerpointworkbench.com wrote in message ... 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 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Glen
I beleive your problem would have been caused by an integer value hav provision for +- symbol which and will show as a space if the number i positiv -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
That could be spot on! I worked around it by converting to a new srting variable, and deleting the first character. I needed to get these spaces out as the data goes into ArcGis and it hates spaces between tabs. Thanks. -- 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 "mudraker " wrote in message ... Glen I beleive your problem would have been caused by an integer value have provision for +- symbol which and will show as a space if the number is positive --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Unwanted spaces in merged cells | Excel Discussion (Misc queries) | |||
remove unwanted spaces? | Excel Worksheet Functions | |||
Deleting unwanted lead spaces throughout a worksheet | Excel Worksheet Functions | |||
Unwanted spaces | Excel Worksheet Functions | |||
how do I remove leading spaces and leave the remianing spaces w | Excel Worksheet Functions |