前两天写的面试用的,run macro-> select file->processing
所在版块:求学狮城 发贴时间:2009-03-31 23:38  评分:

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
Public BoolOpenSuccess As Boolean


Private Sub start_Click()

Dim Value As String

Call OpenFile(StrFileName, BoolOpenSuccess)
Application.ScreenUpdating = False
If BoolOpenSuccess = False Then
Exit Sub
End If

'open file for input
Open StrFileName For Input As #5
Do While Not EOF(5)
On Error Resume Next
Line Input #5, strLine

'Get stepsize info
If BoolGetWidth = False Then
If InStr(1, strLine, "Pulse width:") > 0 Then
BoolGetWidth = True

If InStr(1, strLine, "ns") > 0 Then
'Pulse width
'Format: Pulse width:100ns
pos1 = InStr(1, strLine, ":")
pos2 = InStr(pos1, strLine, "s")
Value = Mid(strLine, pos1 + 1, pos2)
'store value in sheet
Worksheets("Result").Range("C10") = Value
Exit Do
End If

End If
End If

Loop

'close file
Close #5
End Sub

Sub OpenFile(strTemp, BoolOpenSuccess)

strTemp = Application.GetOpenFilename("All Files (*.*), *.*)")
If strTemp = False Then 'user chooses cancel
MsgBox "File Open Failed, Exit"
BoolOpenSuccess = False
Exit Sub
Else
BoolOpenSuccess = True
End If
End Sub

.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!


工作了,很少去学校。我可以提供进货渠道及100多个客户号码给想在NUS卖卡的朋友
Photobucket
 相关帖子 我要回复↙ ↗回到正文
Excel Macro expert please come in o_o   (172 bytes , 748reads )
前两天写的面试用的,run macro-> select file->processing nus_card   (1431 bytes , 462reads )
如果你的file1位置固定,可以用以下的code nus_card   (490 bytes , 375reads )
上面的code用前要做些相应的修改:) nus_card   (0 bytes , 301reads )
学这个东西要先研究别人是怎样写的 nus_card   (19 bytes , 275reads )
厉害~~那里去看别人写的呀? 九妹   (0 bytes , 260reads )
我当时是实习,老板就把前辈的程序让我看 nus_card   (111 bytes , 276reads )
方法很多,说个最简单易懂的 7-UP   (229 bytes , 313reads )
不好意思,写错了 :P 7-UP   (543 bytes , 685reads )