ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Windows Scripting (https://www.excelbanter.com/excel-programming/388257-windows-scripting.html)

Anant Basant[_2_]

Windows Scripting
 
Hi,

I was doing a project in Excel VBA where I needed to capture the list of
installed printers on user's machine and based on that I wanted to limit
access to certain printers. I have heard that Windows Scripting can help
tremendously in such tasks. Does anyone know about a site on the web where I
can explore more about this feature?

Thanks & best regards
Anant



NickHK

Windows Scripting
 
Anant,
What do you by "limit access to certain printers" ?
Presumably the user has permission to all the printers installed on the
system. Do you mean that certain files should only be printed on certain
printer(s) ?

NickHK

"Anant Basant" wrote in message
...
Hi,

I was doing a project in Excel VBA where I needed to capture the list of
installed printers on user's machine and based on that I wanted to limit
access to certain printers. I have heard that Windows Scripting can help
tremendously in such tasks. Does anyone know about a site on the web where

I
can explore more about this feature?

Thanks & best regards
Anant





urkec

Windows Scripting
 
You can find about Windows Scripting at Microsoft Script Center:

http://www.microsoft.com/technet/scr...r/default.mspx

Most of the samples are VBScript, but I think you can easily convert them to
VBA. Here is a sample script that lists all the printers on local computer:

Sub ListPrinters()

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")

For Each objPrinter In colInstalledPrinters
Debug.Print "Name: " & objPrinter.Name
Debug.Print "Location: " & objPrinter.Location
Debug.Print "Default: " & objPrinter.Default
Next

End Sub

Hope this is of some help.

--
urkec


"Anant Basant" wrote:

Hi,

I was doing a project in Excel VBA where I needed to capture the list of
installed printers on user's machine and based on that I wanted to limit
access to certain printers. I have heard that Windows Scripting can help
tremendously in such tasks. Does anyone know about a site on the web where I
can explore more about this feature?

Thanks & best regards
Anant




Anant Basant[_2_]

Windows Scripting
 
Hi Nick,

I wanted to have the list of installed printers in a combobox, from where
users can choose the printer they want, and also I could limit the list such
that certain printers (color printers) do not appear in the list. If I use
the option of default print dialog box in my macro, it would list all the
printers available to the user, that is why I didn't want to use this
option.

Further I have found a script centre at
http://www.microsoft.com/technet/scr...r/default.mspx where I can learn more
about scripting.

Thanks very much for your note.

Regards
Anant

"NickHK" wrote in message
...
Anant,
What do you by "limit access to certain printers" ?
Presumably the user has permission to all the printers installed on the
system. Do you mean that certain files should only be printed on certain
printer(s) ?

NickHK

"Anant Basant" wrote in message
...
Hi,

I was doing a project in Excel VBA where I needed to capture the list of
installed printers on user's machine and based on that I wanted to limit
access to certain printers. I have heard that Windows Scripting can help
tremendously in such tasks. Does anyone know about a site on the web
where

I
can explore more about this feature?

Thanks & best regards
Anant








All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com