开发者

How to convert excel file to text file? [closed]

开发者 https://www.devze.com 2023-03-18 00:21 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reo开发者_StackOverflow社区pened, visit the help center. Closed 10 years ago.

Can anyone help me how to convert txt file to xls file? Any help will be highly appreciated. Thanks!


Convert XLS to CSV on command line

I guess the above works in reverse.

If you want to work with the data itself in VB6 (I assume you do because of the tag), see this code pinched from this thread:

Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset

cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=" & "C:\Documents and Settings\...\My Documents\My Database\Text;" & _
            "Extended Properties=""Text;HDR=No;"""

rs.Open "Select * from TextFile.csv", cnn, adOpenStatic, adLockReadOnly, adCmdText

'...
'...
'...

rs.Close
cnn.Close
Set cnn = Nothing

CSV is a special case of TXT type where fields are comma-separated. You should be able to nominate any character including space or tab as the delimiter.

0

精彩评论

暂无评论...
验证码 换一张
取 消