|
楼主 |
发表于 2011-3-29 14:57
|
显示全部楼层
对了,刚才有网友问,能不能直接在FTP上面打开EXCEL文件
可以的- filename = "ftp://10.15.88.96/a/ftp%BC%DB%B8%F1.xls"
- Workbooks.Open (filename), ReadOnly:=True
复制代码 以上代码就是,打开FTP根目录下A文件夹中的”FTP价格.xls“
网址上面,中文必须用URLEncode转码,URLEncode函数代码如下:- Public Function URLEncode(strInput As String) As String
- '-------------------------------------------------------
- '示例: Debug.Print URLEncode("PowerBASIC中国")
- '-------------------------------------------------------
- Dim strOutput As String
- Dim intAscii As Integer
- Dim I As Integer
- Dim strTemp As String
- For I = 1 To Len(strInput)
- intAscii = Asc(Mid(strInput, I, 1))
- If ((intAscii < 58) And (intAscii > 47)) Or _
- ((intAscii < 91) And (intAscii > 64)) Or _
- ((intAscii < 123) And (intAscii > 96)) _
- Then
- strOutput = strOutput & Chr$(intAscii)
- Else
- strTemp = Trim$(Hex$(intAscii))
- strOutput = strOutput & "%" & Left(strTemp, 2) & "%" & Right(strTemp, 2)
- End If
- Next
- URLEncode = strOutput
- End Function
复制代码 |
|