fso.createtextfile()应该是TextStream型的,所以这段代码应该改为:
Dim fso As New FileSystemObject, txtfile As TextStream   <-此处为修改之处
    Set txtfile = fso.CreateTextFile("temp.txt", True)
    txtfile.WriteLine ("hello,world")
    txtfile.Close这样就可以了