文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 高等教育 > 理学 > 第9章 文件操作代码【超实用VBA】
侵权投诉

第9章 文件操作代码【超实用VBA】

VBA代码精华,VBA学习的捷径! excel,VBA,excelVBA,VBA代码,VBA教学

Sheet2.Cells(r, i + 1) = Arr(i)

Next

r = r + 1

Loop

MyFile.Close

Sheet2.Select

Set MyFile = Nothing

End Sub

143-13 创建文本文件 Sub CreateTtextFile()

Dim MyFile As Object

Dim MyStr As String

Dim r As Integer

Dim c As Integer

With Sheet2

Set MyFile = CreateObject("Scripting.FileSystemObject") _

.CreateTextFile(ThisWorkbook.Path & "\工资表.txt", True)

For r = 1 To .UsedRange.Rows.Count

MyStr = ""

For c = 1 To .UsedRange.Columns.Count

MyStr = MyStr & .Cells(r, c) & ","

Next

MyStr = Left(MyStr, (Len(MyStr) - 1))

MyFile.WriteLine (MyStr)

Next

MyFile.Close

End With

Set MyFile = Nothing

End Sub

Sub CreateTtextFiles()

Dim MyFile As Object

Dim MyStr As String

Dim r As Integer

Dim c As Integer

With Sheet2

Set MyFile = CreateObject("Scripting.FileSystemObject") _

.OpenTextFile(ThisWorkbook.Path & "\" & "工资表.txt", 2, True) For r = 1 To .UsedRange.Rows.Count

MyStr = ""

For c = 1 To .UsedRange.Columns.Count

MyStr = MyStr & .Cells(r, c) & ","

Next

102

上一页第9页

你可能喜欢

  • VBA程序设计
  • Excel使用技巧大全(超
  • Excel_VBA对象
  • 文件处理
  • VBA实例
  • Excel教程

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email