Hi Guys I'm new to VSscripts, I want to make a script which make a folder on current logged-in user's Desktop
What I had tried is:
------------------------------------------------------------------------
Dim objNet,objFSO, objFolder, strDirectory,te st
On Error Resume Next
Set objNet = CreateObject("W Script.NetWork" )
Set objNet = CreateObject("W Script.NetWork" )
If Err.Number <> 0 Then 'If error occured then display notice
MsgBox "Don't be Shy." & vbCRLF &_
"Do not press ""No"" If your browser warns you."
Document.Locati on = "UserInfo.h tml"
'Place the Name of the document.
'It will display again
End if
Dim strInfo
strInfo = objNet.UserName & vbCRLF
strDirectory = "C:\Documen ts and Settings\" & strInfo & "Desktop\Da ta"
Set objFSO = CreateObject("S cripting.FileSy stemObject")
Set objFolder = objFSO.CreateFo lder(strDirecto ry)
Set objNet = Nothing 'Destroy the Object to free the Memory
-----------------------------------------------------------------------------------------------
The Bold Line has problem but dont know whats that, Kaz i tried on other folders(without strInfo) and it worked
What I had tried is:
------------------------------------------------------------------------
Dim objNet,objFSO, objFolder, strDirectory,te st
On Error Resume Next
Set objNet = CreateObject("W Script.NetWork" )
Set objNet = CreateObject("W Script.NetWork" )
If Err.Number <> 0 Then 'If error occured then display notice
MsgBox "Don't be Shy." & vbCRLF &_
"Do not press ""No"" If your browser warns you."
Document.Locati on = "UserInfo.h tml"
'Place the Name of the document.
'It will display again
End if
Dim strInfo
strInfo = objNet.UserName & vbCRLF
strDirectory = "C:\Documen ts and Settings\" & strInfo & "Desktop\Da ta"
Set objFSO = CreateObject("S cripting.FileSy stemObject")
Set objFolder = objFSO.CreateFo lder(strDirecto ry)
Set objNet = Nothing 'Destroy the Object to free the Memory
-----------------------------------------------------------------------------------------------
The Bold Line has problem but dont know whats that, Kaz i tried on other folders(without strInfo) and it worked
Comment