|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
我在2003中把宏的安全设置设置为低了,还是不行,以下是那句代码:
Set fs = CreateObject("Scripting.FileSystemObject")
运行时提示:运行时错误'429'
ActiveX部件不能创建对象。
以下是添加七个文本控件(名称分别为xh,xm,zz,yw,sx,yy,sw)和一个命令按钮后在命令按钮中的全部代码:
Private Sub CommandButton1_Click()
Dim readdate, writedata As String
Dim textline1
readdata = ""
writedata = xh.Text + " " + xm.Text + " " + zz.Text + " " + yw.Text + " " + sx.Text + " " + yy.Text + " " + sw.Text
Set fs = CreateObject("Scripting.FileSystemObject")
Open "教师情况.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, textline1
readdata = readdata + textline1 + vbCrLf
Loop
Close #1
Set a = fs.CreateTextFile("教师情况.txt", True)
a.Writeline (readdata + writedata)
a.Close
Dim TextLine
jlxs.Text = ""
Open "教师情况.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, TextLine
jlxs.Text = jlxs.Text + TextLine + vbCrLf
Loop
Close #1
End Sub |
|