On this line, I am getting “The system cannot find the file specified”<\/p>\n
I am trying to open excel, even more frustrating is that this used to work with excel, now it doesnt. Is it because i am on excel 2016 now?<\/p>","upvoteCount":4,"answerCount":11,"datePublished":"2017-07-19T20:01:30.000Z","author":{"@type":"Person","name":"colbyteneyck2","url":"https://community.spiceworks.com/u/colbyteneyck2"},"acceptedAnswer":{"@type":"Answer","text":"
fixed. excel had the wrong path in dcom<\/p>","upvoteCount":1,"datePublished":"2017-07-20T17:47:14.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/9","author":{"@type":"Person","name":"colbyteneyck2","url":"https://community.spiceworks.com/u/colbyteneyck2"}},"suggestedAnswer":[{"@type":"Answer","text":"
Set objExcel = CreateObject(\"Excel.Application\")\n<\/code><\/pre>\nOn this line, I am getting “The system cannot find the file specified”<\/p>\n
I am trying to open excel, even more frustrating is that this used to work with excel, now it doesnt. Is it because i am on excel 2016 now?<\/p>","upvoteCount":4,"datePublished":"2017-07-19T20:01:30.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/1","author":{"@type":"Person","name":"colbyteneyck2","url":"https://community.spiceworks.com/u/colbyteneyck2"}},{"@type":"Answer","text":"
What else goes with it, that is not enough info.<\/p>","upvoteCount":0,"datePublished":"2017-07-19T20:08:50.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/2","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
Also the usual disclaimer…<\/p>\n
If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>","upvoteCount":0,"datePublished":"2017-07-19T20:09:09.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/3","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
Full source:<\/p>\n
'###################################################################\n'## Script to check the status of machines ##\n'## Author: Unknown \t\t ##\n'## Date: 03-30-2012 \t\t ##\n'## modified by: Vikas Sukhija ##\n'###################################################################\n'# call excel applicationin visible mode\nSet objExcel = CreateObject(\"Excel.Application\")\nobjExcel.Visible = True\nobjExcel.Workbooks.Add\nintRow = 2\n\n'# Define Labels \nobjExcel.Cells(1, 1).Value = \"Machine Name\"\nobjExcel.Cells(1, 2).Value = \"Results\"\n \n'# Create file system object for reading the hosts from text file\nSet Fso = CreateObject(\"Scripting.FileSystemObject\")\nSet InputFile = fso.OpenTextFile(\"c:\\Store\\MachineList.Txt\")\n \n'# Loop thru the text file till the end \nDo While Not (InputFile.atEndOfStream)\nHostName = InputFile.ReadLine\n \n'# Create shell object for Pinging the host machines \nSet WshShell = WScript.CreateObject(\"WScript.Shell\")\nPing = WshShell.Run(\"ping -n 1 \" & HostName, 0, True)\nobjExcel.Cells(intRow, 1).Value = HostName\n \n'# use switch case for checking the machine updown status\nSelect Case Ping\nCase 0 objExcel.Cells(intRow, 2).Value = \"Up\"\nCase 1 objExcel.Cells(intRow, 2).Value = \"Down\"\nEnd Select\nintRow = intRow + 1\n \nLoop\n<\/code><\/pre>\nI did use the “insert code” on the OP, i dont know what happened<\/p>","upvoteCount":0,"datePublished":"2017-07-19T20:10:49.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/4","author":{"@type":"Person","name":"colbyteneyck2","url":"https://community.spiceworks.com/u/colbyteneyck2"}},{"@type":"Answer","text":"
So… that looks like VB script… you posted in the PowerShell forum… :¬)<\/p>","upvoteCount":0,"datePublished":"2017-07-19T20:14:00.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/5","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
Correct. I couldn’t find a VB or scripting forum.<\/p>","upvoteCount":0,"datePublished":"2017-07-19T20:17:21.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/6","author":{"@type":"Person","name":"colbyteneyck2","url":"https://community.spiceworks.com/u/colbyteneyck2"}},{"@type":"Answer","text":"
It’s been a long time (12+ years?) since I’ve launched Excel from VBScript, but digging through my old code I see that I’m applying a file type constant prior to launching. Pretty sure this does not fit your scenario. I tried running with the line present and missing and had no failures either way.<\/p>\n
Const msoFileTypeExcelWorkbooks = 4\nSet objExcel = CreateObject(\"Excel.Application\")\n\n<\/code><\/pre>\nI copied your first few lines of code and ran them on my machine without a problem. Windows 10 with Office 2010.<\/p>\n
My suggestion: find a machine with an older version of Office and try it there.<\/p>\n
How are you launching the script? Inside an IDE, from the command line, as a task, …?<\/p>","upvoteCount":0,"datePublished":"2017-07-19T21:58:15.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/7","author":{"@type":"Person","name":"AdmiralKirk","url":"https://community.spiceworks.com/u/AdmiralKirk"}},{"@type":"Answer","text":"
$objExcel = new-object -comobject excel.application \n<\/code><\/pre>\nI tried this powershell command to start excel and it also doesnt work. here is the error:<\/p>\n
new-object : Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed
\ndue to the following error: 80070002 The system cannot find the file specified. (Exception from HRESULT: 0x80070002).
\nAt line:1 char:1<\/p>\n
\n- new-object -comobject excel.application<\/li>\n
- \n
<\/code><\/pre>\n<\/li>\n- CategoryInfo : NotSpecified: (
[New-Object], FileNotFoundException<\/li>\n - FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.NewObjectCommand<\/li>\n<\/ul>\n
So something isnt allowing excel to open from the COM object<\/p>","upvoteCount":0,"datePublished":"2017-07-20T12:39:52.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/8","author":{"@type":"Person","name":"colbyteneyck2","url":"https://community.spiceworks.com/u/colbyteneyck2"}},{"@type":"Answer","text":"
How did you change the path? I am facing the same issue.<\/p>","upvoteCount":0,"datePublished":"2017-12-07T22:01:23.000Z","url":"https://community.spiceworks.com/t/vbs-80070002-when-opening-excel/594542/10","author":{"@type":"Person","name":"seanwatson","url":"https://community.spiceworks.com/u/seanwatson"}},{"@type":"Answer","text":"