Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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,xlPasteSpecialOperationNone,false,false); <- doesn't work, but this is what I need to work...
}
</script>

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |