Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 2nd, 2006, 10:40 AM
Friend of Wrox
 
Join Date: Mar 2004
Location: Ottawa, , Canada.
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default Jscript Excel PasteSpecial

Hi,

I'm trying to do some automation of Excel through Jscript, but I keep getting an error in regards to when I try to pastespecial (PasteSpecial method of Range class failed). Any help would be great...

<script type="text/javascript">
var objXl, ws;
function test()
{
    objXl = new ActiveXObject("Excel.Application");
    objXl.Visible = true; //set to TRUE for debugging
    objXl.WorkBooks.open(document.forms[0].tFile.value);
    ws = objXl.ActiveSheet;

    var xlPasteValues = -4163;
    var xlPasteSpecialOperationNone = -4142;
    var xlPasteFormulas = -4123;
    var total = ws.UsedRange.Rows.Count;

    ws.Range("C2").value = "=concatenate(A2,\" \",B2)";
    ws.Range("C2").Copy();
    ws.Range("C2:C"+total).Select();
// ws.PasteSpecial(); <- works but copies the formula
// ws.PasteSpecial(xlPasteValues,xlPasteSpecialOperat ionNone,false,false); <- doesn't work, but this is what I need to work...
}
</script>

Reply With Quote
  #2 (permalink)  
Old June 11th, 2006, 09:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: High Wycombe, UK, United Kingdom.
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

The code shown at http://p2p.wrox.com/topic.asp?TOPIC_ID=33665 seems to have a few minor differences to yours, suggest you try them out and let us know if it works.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JScript DumAss HTML Code Clinic 1 August 25th, 2004 02:46 AM
Using JScript with VBScript jwalborn Javascript How-To 4 October 13th, 2003 10:07 AM
PLEASE HELP! ACTIVEX in JScript stalker Javascript 2 August 15th, 2003 05:04 PM
JScript Des67 Javascript 1 July 28th, 2003 05:05 AM



All times are GMT -4. The time now is 09:59 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.