当前位置:文档之家› VB读取EXCEL写入TXT(TxtList)源代码 - zhug_1970的日志 - 网易博客

VB读取EXCEL写入TXT(TxtList)源代码 - zhug_1970的日志 - 网易博客

VB读取EXCEL写入TXT(TxtList)源代码 - zhug_1970的日志 - 网易博客网易 新闻
微博
邮箱
闪电邮
相册
有道
手机邮
印像派
梦幻人生

更多 博客 博客首页
博客话题
热点专题
博客油菜地
找朋友
博客圈子
博客风格
手机博客
短信写博
邮件写博
博客复制
群博客 摄影 主题展区
喜欢好图
每月精选
每日专题
影像故事
高级拍客
摄影人物志
摄影师专访
摄影点评 发现好博客 群博客召集令注册 登录 显示下一条 | 关闭 Blave的博客计算机学习和环境评价及规划方面的内容导航
首页 日志 相册 音乐 收藏 博友 关于我 日志 zhug_197
加博友 关注他
最新日志
关于黑龙江省生态功能区划编转发自治区国土资源厅关于矿呼和浩特市国民经济和社会发广西壮族自治区人民政府关于广西壮族自治区人民政府办公WINRAR的分卷压缩,合并功能该作者的其他文章
博主推荐
相关日志
随机阅读
首页推荐
史上最牛洋妞北漂生活为生儿子躲居深山12年自然界四大食肉植物日本最肥相扑惊人饭量体验法国裸体高尔夫球重430斤'太岁'见过没更多>>对“推广广告”提建议

VB中如何读取txt文件的数据 QQ邮箱 - 噪声影响评价系统(NoiseSystem)试用版下载-附下载链接
VB读取EXCEL写入TXT(TxtList)源代码默认分类 2010-07-28 16:22:12 阅读223 评论1 字号:大中小 订阅 Dim
xlApp1 As Excel.Application '¶¨ÒåEXCELÀà
Dim xlBook As Excel.Workbook '¶¨Ò幤¼þ²¾Àà
Dim xlsheet As Excel.Worksheet '¶¨Ò幤×÷±íÀà
Dim filename As String
Dim lie As Integer
Private Declare Function SendMessage Lib "user32 " Alias "SendMessageA" (ByVal
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_SETHORIZONTALEXTENT = &H194
Private Sub setListWidth(ByVal demo_lbox As ListBox)
'Èç¹ûÁбí¿ò²>¹>¿í£¬ÔòÔö¼ÓË®Æ&fr ac12;¹ö¶¯Ìõ
Dim i As Integer
Dim List_MaxL As Integer
'>ñµÃÑ¡Ï&icir c;ÄÚÈݵÄ×î´ó³¤¶È
For i = 0 To demo_lbox.ListCount - 1
''ÈÃlist_maxlÖб£´æ×µÄÒ>Ìõ×Ö´®
If Len(demo_lbox.List(i)) > List_MaxL Then
List_MaxL = Len(demo_lbox.List(i)) + 2
End If
Next i
'ÅжÏÊÇ·ñÄÚÈÝÏÔ ;ʾ²>ÍêÈ<£¬Èç¹û& Ecirc;

ÇÔòÌí¼Óˮƽ¹&o uml;¶¯Ìõ
If Me.TextWidth("AA ") * List_MaxL > demo_lbox.Width Then
SendMessage demo_lbox.hwnd, LB_SETHORIZONTALEXTENT, Me.TextWidth("a") *
List_MaxL, ByVal 0&
End If
End Sub
Private Sub Command1_Click()
Dim tmp As String
tmp = List1.Text '>ñÈ¡µ±Ç°Ñ¡ÖÐÄÚÈ&Y acute;
If tmp = "" Then
Exit Sub
End If
List2.AddItem (tmp) '½<Ñ¡ÔñÄ&Uacu te;ÈÝÒƵ½li st2
List1.RemoveItem (List1.ListIndex) 'ɾ³ýÑ¡&Oum l;ÐÄÚÈÝ
tmp = ""
If List2.ListCount = 10 Then
MsgBox "ÏÂÒ>ÌõÊ&yacu te;¾Ý¿ªÊ¼&fr ac12;<²>Äܱ>ReplacExcel¶ÁÈ¡£&ie xcl;", 32,
"¾¯¸æ"
End If
Call setListWidth(List2)
End Sub
Private Sub Command10_Click()
List2.Clear
End Sub
Private Sub Command11_Click()
List1.Clear
End Sub
Private Sub Command2_Click()
Dim tmp1 As String
If (List2.ListIndex <> 0) Then 'Èç¹ûÑ¡Ö ;ÐÏîÊǵÚ&O grave;>ÏîÔò²>Ö´Ðн>>>
tmp1 = List2.Text
List2.List(List2.ListIndex) = List2.List(List2.ListIndex - 1) '½>>>Ñ¡ÖÐÏî&o
rdm;ÍÇ°Ò>ÏîµÄÄÚ&E grave;Ý
List2.List(List2.ListIndex - 1) = tmp1
End If
End Sub
Private Sub Command3_Click()
List2.RemoveItem (List2.ListIndex)
End Sub
Private Sub Command4_Click()
Dim tmp1 As String
If (List2.ListIndex <> List2.ListCount - 1) Then 'Èç¹ûÑ¡Ö ;ÐÏîÊǵÚ&O
grave;>ÏîÔò²>Ö´Ðн>>>
tmp1 = List2.Text
List2.List(List2.ListIndex) = List2.List(List2.ListIndex + 1) '½>>>Ñ¡ÖÐÏî&o
rdm;ÍÇ°Ò>ÏîµÄÄÚ&E grave;Ý
List2.List(List2.ListIndex + 1) = tmp1
End If
End Sub
Private Sub Command5_Click()
Dim tmp As String
tmp = List2.Text '>ñÈ¡µ±Ç°Ñ¡ÖÐÄÚÈ&Y acute;
If tmp = "" Then
Exit Sub
End If
List1.AddItem (tmp) '½<Ñ¡ÔñÄ&Uacu te;ÈÝÒƵ½li st2
List2.RemoveItem (List2.ListIndex) 'ɾ³ýÑ¡&Oum l;ÐÄÚÈÝ
tmp = ""
End Sub
Private Sub Command6_Click()
On Error Resume Next
Dim i As Integer
Open App.Path & "\data.txt" For Append As #1
For i

= 0 To List2.ListCount - 1
Print #1, List2.List(i) & ";";
Next i
Write #1,
Close #1
MsgBox "Êý¾ÝÒÑ&f rac34;­Ð´Èëdata.txt£ ;¡", 64, "дÈëÍê³É"


引文来源 VB读取EXCEL写入TXT(TxtList)源代码_IT电脑科学技术网
评论这张 转发至微博 0人 | 分享到: 阅读(223)| 评论(1)| 引用 (0) |举报
VB中如何读取txt文件的数据 QQ邮箱 - 噪声影响评价系统(NoiseSystem)试用版下载-附下载链接
历史上的今天

相关文章

最近读者
登录后,您可以在此留下足迹。 pphhbb12 大大 gotoxiya 喜子

评论
点击登录|昵称:
取消 验证码:换一张

04-02 21:19d
妈的回复
上一页 1... -1-1-1-1-1-1-1... -1下一页 页脚
公司简介 - 联系方法 - 招聘信息 - 客户服务 - 相关法律 - 博客风格 - 手机博客 - 订阅此博客
网易公司版权所有 ©1997-2011

相关主题
文本预览
相关文档 最新文档