Try this
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")
username=WshNetwork.UserName
file = ("C:\Documents and Settings\"& username & "\Application Data\Microsoft\Outlook\test.txt")
if fso.FileExists(file) Then
fso.DeleteFile file...
Make this in VBA
ActivePrinter = "printer name without on NExx:"
If you want to know the name of the defalut printer in a Word+VBA, do:
msgbox activeprinter
in a vbs file, put:
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set Printers = WshNetwork.EnumPrinterConnections
For i = 0 to Printers.Count - 1 Step 2
WScript.Echo i,i+1,"",Printers.Item(i),Printers.Item(i+1)
Next
WshNetwork.SetDefaultPrinter Printers.Item(0)
Or...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.