Click here to Skip to main content
Rate this: bad
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
Edited 4-Oct-12 2:43am
learner'sbug at 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
0 Sergey Alexandrovich Kryukov 398
1 CPallini 333
2 George Jonsson 270
3 OriginalGriff 159
4 Prasad Khandekar 135
0 OriginalGriff 4,613
1 CPallini 3,340
2 Sergey Alexandrovich Kryukov 2,771
3 George Jonsson 2,254
4 Gihan Liyanage 2,020

Advertise | Privacy | Mobile
Web04 | 2.8.140905.1 | Last Updated 29 Oct 2012
Copyright © CodeProject, 1999-2014
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