<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> Problem Description
I am using Excel 2003 and the API function URLDownloadToFile. My procedure downloads a text file from my website to my PC. However, the contents of that text file become concatenated upon download. I am unable to understand why the original formatting of the text file is changed when using the URLDownloadToFile procedure. For example, I have a text file on my PC containing strings of numbers that looks similar to the following:
344890
100300
989045
670230
110145
I upload this file via FTP to my web server without any problems. Using my FTP program, I can then transfer the file directly back to my PC. When I check the formatting of the just-transferred file, it appears exactly as shown above. However, when I try to transfer the file using URLDownloadToFile using Excel, the file is still downloaded from my website without any error. But, the contents of the text file have been concatenated. For examples, the contents of the file now appear as the following:
344890100300989045670230110145
Any ideas on why this is happening???
My PC / System Background
- Excel 2003 running on Windows Vista Ultimate, 4 GB RAM
Copy of Source Code (Module1)
Option Explicit
Declare Sub sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Sub testcode()
Dim intDone As Integer
Dim ans As Integer
Dim intSum As Integer
Call PauseProcedure
intDone = URLDownloadToFile(0, "http://www.palomardata.com/testfile.txt", "C:\Users\Matt\Desktop\testfiledownload.txt", 0, 0)
Call PauseProcedure
End Sub
Sub PauseProcedure()
sleep 100
End Sub
I am using Excel 2003 and the API function URLDownloadToFile. My procedure downloads a text file from my website to my PC. However, the contents of that text file become concatenated upon download. I am unable to understand why the original formatting of the text file is changed when using the URLDownloadToFile procedure. For example, I have a text file on my PC containing strings of numbers that looks similar to the following:
344890
100300
989045
670230
110145
I upload this file via FTP to my web server without any problems. Using my FTP program, I can then transfer the file directly back to my PC. When I check the formatting of the just-transferred file, it appears exactly as shown above. However, when I try to transfer the file using URLDownloadToFile using Excel, the file is still downloaded from my website without any error. But, the contents of the text file have been concatenated. For examples, the contents of the file now appear as the following:
344890100300989045670230110145
Any ideas on why this is happening???
My PC / System Background
- Excel 2003 running on Windows Vista Ultimate, 4 GB RAM
Copy of Source Code (Module1)
Option Explicit
Declare Sub sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Sub testcode()
Dim intDone As Integer
Dim ans As Integer
Dim intSum As Integer
Call PauseProcedure
intDone = URLDownloadToFile(0, "http://www.palomardata.com/testfile.txt", "C:\Users\Matt\Desktop\testfiledownload.txt", 0, 0)
Call PauseProcedure
End Sub
Sub PauseProcedure()
sleep 100
End Sub