|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
哪位大师可以帮忙解读一下下面这段代码,为什么snp文件存储路径不是我所指定文件夹,而是保存在thisworkbook.path的上一级。下面代码中有路径变换的语句吗?如果我想修改到指定的文件夹(D:\temp)内,该怎么修改下面的代码来实现,请各位高手指点一下,谢谢!
下面代码的功能是保存E5071C网分仪上的SNP数据到本地电脑的一个过程
Public Sub SaveSnpFile(sDstFile As String, sCh As String, sPort As String)
Dim strSrcFile As String
Dim strDstFile As String
Dim blnSave As Boolean
Dim hFile As Long
Dim byteData() As Byte
blnSave = False
AgeENA.WriteString ":DISP:WIND" & sCh & ":ACT", True
strSrcFile = """D:\agisnp." & sPort & """"
AgeENA.WriteString ":MMEM:STOR:SNP:DATA " & strSrcFile, True
If Not ErrorCheck Then Exit Sub
strDstFile = sDstFile
AgeENA.WriteString ":MMEM:TRAN? " & strSrcFile
byteData = AgeENA.ReadIEEEBlock(BinaryType_UI1)
hFile = FreeFile()
Open strDstFile For Binary Access Write Shared As hFile
blnSave = True
Put #hFile, , byteData
AgeENA.WriteString ":MMEM:DEL " & strSrcFile, True
If blnSave Then Close #hFile
End Sub
|
|