16,554
社区成员
发帖
与我相关
我的任务
分享
Dim MyDesktop As String =Environment.GetEnvironmentVariable("Desktop")
FILENAME = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\" & E & "TOP100.xls "
'后面要用到 System.IO.Path,所以不要取容易引起歧义的命名'
Dim desktopPath As String = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim sw As FileStream = File.Create(Path.Combine(desktopPath ,"有限元计算结果.xlsx"), FileMode.Create)
OutPbook.Write(sw)
sw.Close()
Public DesktopPath As String = OpenRegistryPath(Registry.CurrentUser, "/Software/Microsoft/Windows/CurrentVersion/Explorer/Shell Folders").GetValue("Desktop").ToString()
Public Function OpenRegistryPath(root As RegistryKey, s As String) As RegistryKey
s = s.Remove(0, 1) & "/"
While s.IndexOf("/") <> -1
root = root.OpenSubKey(s.Substring(0, s.IndexOf("/")))
s = s.Remove(0, s.IndexOf("/") + 1)
End While
Return root
End Function