Click here to Skip to main content
12,890,879 members (55,664 online)
Rate this:
Please Sign up or sign in to vote.

<script language="javascript">
   function PrintLabel() 
       var ccc = 0;
       var zp = new ActiveXObject('ZebraPrint.ZebraPrintCtl');
       zp.TcpConnection('', '6101');
       var i = zp.Print('<?xml version="1.0"?>Test Text</xml>');
<form id="form1">
  <asp:Button ID="btnPrint" runat="server" Text="Print" OnClientClick="javascript:PrintLabel();return false;" />

Running this script on IE 7 which is giving an error called "Automation server can't create object". I tried doing this by changing security levels to a custom level when running on a web server.

Tools Menu -> Internet Options -> Security -> Custom level -> "Initialize and script ActiveX controls not marked as safe for scripting"

But still its giving the same error.
Your suggestions and inputs are highly appreciable.

Posted 13-Aug-12 19:53pm
Updated 4-Oct-12 2:43am
learner'sbug 16-Aug-12 16:48pm
Did you check this link..

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I have Excel and Word set to Run as Administrator. I do this so I can save files anywhere that I like - not impressed with the efforts to stop me saving into the 'Program Files' or 'Program Files (x86)' folders.

The consequence of this is that if I try to create an ActiveX object for either Word or Excel, it fails.... Unless the program that's trying to create those objects is also run as Admin. I set the webserver to run as a service a long time ago and forgot about the problem. It took me about a day recently to re-discover that little gotcha. I don't recall what the error message was, but I'm 99.98% sure it didn't include anything that mentioned security or permission issues.

To get around this issues when testing stuff designed for IE, I have to start IE as Admin. Which is rather irritating since it's a 'special' shortcut in the start menu, right-clicking to see the shortcut's properties so I can set it to "Always run as Admin" just brings up the Internet Options dialog. So, it's either right-click, Run as Admin every blinking time, or it's create a new shortcut. I chose the former..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 29 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100