I created the attached script. It reads (Port name, IP address, Driver name,
Printer name, Share name, Location,
etc. ) from Excell and uses that information to create a bunch of printers
on a print server.
I created this on my test server (Win 2003 SP1) and it works fine.
I coppied the script and the Excell document to the actual Print Server,
also Win 2003 SP1 and when I run it, I get a VBScript Runtime error that
says "ActiveX component can't create object: 'PrintMaster.PrintMaster.1'"
The error is comming from Line 16 Char 1. That is the line that reads: Set
oMaster = CreateObject("PrintMaster.PrintMaster.1")

Any help is appreciated
Thanks
Chris
ccoates@gfs.com



' Printer setup
' This script creats printer ports And installs printers by reading the
' Printer name, Location, driver And IP address from Excell



Dim oPort
Dim oMaster
Dim oPrinter
Dim IP
Dim Net
Dim Model
Dim Location


Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
Set oPort = CreateObject("Port.Port.1")
Set oPrinter = CreateObject("Printer.Printer.1")
'*************** This is the Read Excell Part*******************
Set objXL = CreateObject("Excel.Application")
set objWB = objXL.Workbooks.Open( "c:\printers.xls")
' name of the spreadsheet
Set objWS = objWB.Worksheets("GR") 'assumes the sheet is "sheet1"
objXL.Visible = TRUE
i = 1
' This keeps it from reading the firt line of the spread sheet in case there
are headers
For s = 1 To 135
'This Is the number of lines In the spreadsheet
i = i + 1

IP = objWS.Cells(i,1).Value
Net = objWS.Cells(i,2).Value
Model = objWS.Cells(i,3).Value
location = objWS.Cells(i,5).Value
WScript.Echo i& " " & IP& " " & Net& " " & Model& " " & Location

' *******************************************************************

oPort.ServerName = ""
oPort.PortName = "IP_"&IP
oPort.PortType = 1
oPort.HostAddress = IP
oPort.PortNumber = 9100
oPort.SNMP = false
oPort.SNMPDeviceIndex = 1
oPort.CommunityName = "public"
oPort.QueueName = ""
oPort.DoubleSpool = false
oMaster.PortAdd oPort


If Err <> 0 Then
end If


oPrinter.ServerName = oPort.ServerName
oPrinter.PrinterName = Net
oPrinter.Shared = True
oPrinter.ShareName = Net
oPrinter.Location = Location
oPrinter.Comment = ""
oPrinter.EnableBidi = false
oPrinter.DriverName = Model
oPrinter.PortName = oPort.PortName
oPrinter.DriverPath = ""
oPrinter.InfFile = "c:\windows\inf\ntprint.inf"
oMaster.PrinterAdd oPrinter
oMaster.PrinterSet oPrinter
Next

If Err <> 0 then
end If

Re: ActiveX component can't create object by Michael

Michael
Tue Feb 21 16:37:30 CST 2006

Chris Coates wrote:
> I created the attached script. It reads (Port name, IP address,
> Driver name, Printer name, Share name, Location,
> etc. ) from Excell and uses that information to create a bunch of
> printers on a print server.
> I created this on my test server (Win 2003 SP1) and it works fine.
> I coppied the script and the Excell document to the actual Print
> Server, also Win 2003 SP1 and when I run it, I get a VBScript Runtime
> error that says "ActiveX component can't create object:
> 'PrintMaster.PrintMaster.1'" The error is comming from Line 16 Char
> 1. That is the line that reads: Set oMaster =
> CreateObject("PrintMaster.PrintMaster.1")


I would assume that it simply means that the component (whatever it is)
isn't installed on that server.


>
> Any help is appreciated
> Thanks
> Chris
> ccoates@gfs.com
>
>
>
> ' Printer setup
> ' This script creats printer ports And installs printers by reading
> the ' Printer name, Location, driver And IP address from Excell
>
>
>
> Dim oPort
> Dim oMaster
> Dim oPrinter
> Dim IP
> Dim Net
> Dim Model
> Dim Location
>
>
> Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
> Set oPort = CreateObject("Port.Port.1")
> Set oPrinter = CreateObject("Printer.Printer.1")
> '*************** This is the Read Excell Part*******************
> Set objXL = CreateObject("Excel.Application")
> set objWB = objXL.Workbooks.Open( "c:\printers.xls")
> ' name of the spreadsheet
> Set objWS = objWB.Worksheets("GR") 'assumes the sheet is "sheet1"
> objXL.Visible = TRUE
> i = 1
> ' This keeps it from reading the firt line of the spread sheet in
> case there are headers
> For s = 1 To 135
> 'This Is the number of lines In the spreadsheet
> i = i + 1
>
> IP = objWS.Cells(i,1).Value
> Net = objWS.Cells(i,2).Value
> Model = objWS.Cells(i,3).Value
> location = objWS.Cells(i,5).Value
> WScript.Echo i& " " & IP& " " & Net& " " & Model& " " &
> Location
>
> ' *******************************************************************
>
> oPort.ServerName = ""
> oPort.PortName = "IP_"&IP
> oPort.PortType = 1
> oPort.HostAddress = IP
> oPort.PortNumber = 9100
> oPort.SNMP = false
> oPort.SNMPDeviceIndex = 1
> oPort.CommunityName = "public"
> oPort.QueueName = ""
> oPort.DoubleSpool = false
> oMaster.PortAdd oPort
>
>
> If Err <> 0 Then
> end If
>
>
> oPrinter.ServerName = oPort.ServerName
> oPrinter.PrinterName = Net
> oPrinter.Shared = True
> oPrinter.ShareName = Net
> oPrinter.Location = Location
> oPrinter.Comment = ""
> oPrinter.EnableBidi = false
> oPrinter.DriverName = Model
> oPrinter.PortName = oPort.PortName
> oPrinter.DriverPath = ""
> oPrinter.InfFile = "c:\windows\inf\ntprint.inf"
> oMaster.PrinterAdd oPrinter
> oMaster.PrinterSet oPrinter
> Next
>
> If Err <> 0 then
> end If

--
Michael Harris
Microsoft.MVP.Scripting


Re: ActiveX component can't create object by Chris

Chris
Wed Feb 22 08:17:28 CST 2006

I have narrowed it down to these three lines that are having the same issue
> Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
> Set oPort = CreateObject("Port.Port.1")
> Set oPrinter = CreateObject("Printer.Printer.1")
If I comment them each out the script runs, (it doesn't do anything) but
the errors stop.

What kind of component should I be looking at that needs to be installed for
this to work?

Thanks
Chris



"Chris Coates" <ccoates@gfs.com> wrote in message
news:%234YCM4xNGHA.2624@TK2MSFTNGP12.phx.gbl...
>I created the attached script. It reads (Port name, IP address, Driver
>name, Printer name, Share name, Location,
> etc. ) from Excell and uses that information to create a bunch of printers
> on a print server.
> I created this on my test server (Win 2003 SP1) and it works fine.
> I coppied the script and the Excell document to the actual Print Server,
> also Win 2003 SP1 and when I run it, I get a VBScript Runtime error that
> says "ActiveX component can't create object: 'PrintMaster.PrintMaster.1'"
> The error is comming from Line 16 Char 1. That is the line that reads:
> Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
>
> Any help is appreciated
> Thanks
> Chris
> ccoates@gfs.com
>
>
>
> ' Printer setup
> ' This script creats printer ports And installs printers by reading the
> ' Printer name, Location, driver And IP address from Excell
>
>
>
> Dim oPort
> Dim oMaster
> Dim oPrinter
> Dim IP
> Dim Net
> Dim Model
> Dim Location
>
>
> Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
> Set oPort = CreateObject("Port.Port.1")
> Set oPrinter = CreateObject("Printer.Printer.1")
> '*************** This is the Read Excell Part*******************
> Set objXL = CreateObject("Excel.Application")
> set objWB = objXL.Workbooks.Open( "c:\printers.xls")
> ' name of the spreadsheet
> Set objWS = objWB.Worksheets("GR") 'assumes the sheet is "sheet1"
> objXL.Visible = TRUE
> i = 1
> ' This keeps it from reading the firt line of the spread sheet in case
> there are headers
> For s = 1 To 135
> 'This Is the number of lines In the spreadsheet
> i = i + 1
>
> IP = objWS.Cells(i,1).Value
> Net = objWS.Cells(i,2).Value
> Model = objWS.Cells(i,3).Value
> location = objWS.Cells(i,5).Value
> WScript.Echo i& " " & IP& " " & Net& " " & Model& " " & Location
>
> ' *******************************************************************
>
> oPort.ServerName = ""
> oPort.PortName = "IP_"&IP
> oPort.PortType = 1
> oPort.HostAddress = IP
> oPort.PortNumber = 9100
> oPort.SNMP = false
> oPort.SNMPDeviceIndex = 1
> oPort.CommunityName = "public"
> oPort.QueueName = ""
> oPort.DoubleSpool = false
> oMaster.PortAdd oPort
>
>
> If Err <> 0 Then
> end If
>
>
> oPrinter.ServerName = oPort.ServerName
> oPrinter.PrinterName = Net
> oPrinter.Shared = True
> oPrinter.ShareName = Net
> oPrinter.Location = Location
> oPrinter.Comment = ""
> oPrinter.EnableBidi = false
> oPrinter.DriverName = Model
> oPrinter.PortName = oPort.PortName
> oPrinter.DriverPath = ""
> oPrinter.InfFile = "c:\windows\inf\ntprint.inf"
> oMaster.PrinterAdd oPrinter
> oMaster.PrinterSet oPrinter
> Next
>
> If Err <> 0 then
> end If
>
>



Re: ActiveX component can't create object by Chris

Chris
Wed Feb 22 13:21:52 CST 2006

Problem solved

I needed to install the Resource Kit and register the prnadmin.dll
regsvr32 C:\PROGRA~1\RESOUR~1\prnadmin.dll



"Chris Coates" <ccoates@gfs.com> wrote in message
news:%234YCM4xNGHA.2624@TK2MSFTNGP12.phx.gbl...
>I created the attached script. It reads (Port name, IP address, Driver
>name, Printer name, Share name, Location,
> etc. ) from Excell and uses that information to create a bunch of printers
> on a print server.
> I created this on my test server (Win 2003 SP1) and it works fine.
> I coppied the script and the Excell document to the actual Print Server,
> also Win 2003 SP1 and when I run it, I get a VBScript Runtime error that
> says "ActiveX component can't create object: 'PrintMaster.PrintMaster.1'"
> The error is comming from Line 16 Char 1. That is the line that reads:
> Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
>
> Any help is appreciated
> Thanks
> Chris
> ccoates@gfs.com
>
>
>
> ' Printer setup
> ' This script creats printer ports And installs printers by reading the
> ' Printer name, Location, driver And IP address from Excell
>
>
>
> Dim oPort
> Dim oMaster
> Dim oPrinter
> Dim IP
> Dim Net
> Dim Model
> Dim Location
>
>
> Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
> Set oPort = CreateObject("Port.Port.1")
> Set oPrinter = CreateObject("Printer.Printer.1")
> '*************** This is the Read Excell Part*******************
> Set objXL = CreateObject("Excel.Application")
> set objWB = objXL.Workbooks.Open( "c:\printers.xls")
> ' name of the spreadsheet
> Set objWS = objWB.Worksheets("GR") 'assumes the sheet is "sheet1"
> objXL.Visible = TRUE
> i = 1
> ' This keeps it from reading the firt line of the spread sheet in case
> there are headers
> For s = 1 To 135
> 'This Is the number of lines In the spreadsheet
> i = i + 1
>
> IP = objWS.Cells(i,1).Value
> Net = objWS.Cells(i,2).Value
> Model = objWS.Cells(i,3).Value
> location = objWS.Cells(i,5).Value
> WScript.Echo i& " " & IP& " " & Net& " " & Model& " " & Location
>
> ' *******************************************************************
>
> oPort.ServerName = ""
> oPort.PortName = "IP_"&IP
> oPort.PortType = 1
> oPort.HostAddress = IP
> oPort.PortNumber = 9100
> oPort.SNMP = false
> oPort.SNMPDeviceIndex = 1
> oPort.CommunityName = "public"
> oPort.QueueName = ""
> oPort.DoubleSpool = false
> oMaster.PortAdd oPort
>
>
> If Err <> 0 Then
> end If
>
>
> oPrinter.ServerName = oPort.ServerName
> oPrinter.PrinterName = Net
> oPrinter.Shared = True
> oPrinter.ShareName = Net
> oPrinter.Location = Location
> oPrinter.Comment = ""
> oPrinter.EnableBidi = false
> oPrinter.DriverName = Model
> oPrinter.PortName = oPort.PortName
> oPrinter.DriverPath = ""
> oPrinter.InfFile = "c:\windows\inf\ntprint.inf"
> oMaster.PrinterAdd oPrinter
> oMaster.PrinterSet oPrinter
> Next
>
> If Err <> 0 then
> end If
>
>