Open "C:\Documents and Settings\All Users\desktop\Estamit1.html " For Output As 1
Open "C:\Documents and Settings\All Users\desktop\Estamit1.html " For Output As 1
That is the first line of my save button. what this does is creates a html file on your desktop, and if there is one already there, it overwrites it!
now, the problem! this code wont work on onother pc, dew to the path to the desktop being diff on each pc! so lastnight i was refered to some code, it was over a page worth of code, just to determain or get the path to the desktop, it didt work for me, it was for windows ME i think?
Please tell me there is an easier way? i need to get the desired path, then open the file. if it is to hard to do it this way? what is onother clever way to creat this html file on the desktop?
Re: Open "C:\Documents and Settings\All Users\desktop\Estamit1.html " For Output As 1
try this,
VB Code:
Dim PathToDesktop As String
Set oShell = CreateObject("WScript.Shell")
PathToDesktop = oShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop")
Re: Open "C:\Documents and Settings\All Users\desktop\Estamit1.html " For Output As 1
VB Code:
Const CSIDL_DESKTOP = &H0
Const CSIDL_PROGRAMS = &H2
Const CSIDL_CONTROLS = &H3
Const CSIDL_PRINTERS = &H4
Const CSIDL_PERSONAL = &H5
Const CSIDL_FAVORITES = &H6
Const CSIDL_STARTUP = &H7
Const CSIDL_RECENT = &H8
Const CSIDL_SENDTO = &H9
Const CSIDL_BITBUCKET = &HA
Const CSIDL_STARTMENU = &HB
Const CSIDL_DESKTOPDIRECTORY = &H10
Const CSIDL_DRIVES = &H11
Const CSIDL_NETWORK = &H12
Const CSIDL_NETHOOD = &H13
Const CSIDL_FONTS = &H14
Const CSIDL_TEMPLATES = &H15
Const MAX_PATH = 260
Private Type ITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As ITEMID
End Type
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Print the folders to the form
Me.Print "Start menu folder: " + GetSpecialfolder(CSIDL_STARTMENU)
Me.Print "Favorites folder: " + GetSpecialfolder(CSIDL_FAVORITES)
Me.Print "Programs folder: " + GetSpecialfolder(CSIDL_PROGRAMS)
Me.Print "Desktop folder: " + GetSpecialfolder(CSIDL_DESKTOP)
End Sub
Private Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
'Get the special folder
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NOERROR Then
'Create a buffer
Path$ = Space$(512)
'Get the path from the IDList
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
'Remove the unnecessary chr$(0)'s
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function
Re: Open "C:\Documents and Settings\All Users\desktop\Estamit1.html " For Output As 1
VB Code:
Dim PathToDesktop As String
Set oShell = CreateObject("WScript.Shell")
PathToDesktop = oShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop")
Open PathToDesktop \ help.html For Output As 1
End Sub
???????????????
Re: Open "C:\Documents and Settings\All Users\desktop\Estamit1.html " For Output As 1
Quote:
Originally Posted by Triple_access
VB Code:
Dim PathToDesktop As String
Set oShell = CreateObject("WScript.Shell")
PathToDesktop = oShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop")
Open PathToDesktop \ help.html For Output As 1
End Sub
???????????????
VB Code:
Open PathToDesktop & "\help.htm" For Output As #1
Re: Open "C:\Documents and Settings\All Users\desktop\Estamit1.html " For Output As 1
hrmmmmm?????
VB Code:
Private Sub Command1_Click()
Dim PathToDesktop As String
Set oShell = CreateObject("WScript.Shell")
PathToDesktop = oShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop")
Open PathToDesktop & "\help.htm" For Output As #1
Print #1, "HELLO!!!"
Close 1
End Sub
Works Great!!!!!! THANK YOU, will leave feedback,, great job man!!!!!!!
Re: Open "C:\Documents and Settings\All Users\desktop\Estamit1.html " For Output As 1
Quote:
Originally Posted by Triple_access
hrmmmmm?????
VB Code:
Private Sub Command1_Click()
Dim PathToDesktop As String
Set oShell = CreateObject("WScript.Shell")
PathToDesktop = oShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop")
Open PathToDesktop & "\help.htm" For Output As #1
Print #1, "HELLO!!!"
Close 1
End Sub
Works Great!!!!!! THANK YOU, will leave feedback,, great job man!!!!!!!
glad it worked.. :wave: