如何在EXCEL中运行此宏文件?
iwfkc 2008-01-22 06:39:15 Sub pipeindex()
Open "d:\PIPEINDEX.TXT" For Input As #1
Line Input #1, s
Line Input #1, s
While Not EOF(1)
Line Input #1, s
If Trim(s) <> "" Then
a = Left(s, 50)
b = Right(s, 50)
a = Trim(a)
b = Trim(b)
c = Len(a) - 1
a = Right(a, c)
Selection.TypeText Text:=a
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:=b
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
Selection.MoveRight Unit:=wdCell
End If
Wend
Close #1
End Sub
此代码能在WORD中运行,可在EXCEL中Selection.TypeText Text:=a这句总出错
如何修改才能在EXCEL中运行呀?