800A03EC error while opening excel via vb script









up vote
0
down vote

favorite












I started vb scripting very recently and compiled a vb script (of course googling) to open the excel sheet. However I am getting 800A03EC error - Sorry we could not find the excel sheet. Is it renamed/moved or deleted?



enter image description here



I can manually open the file manually without any error.



Is this because of document classification?



Here is my code



Option Explicit

Sub FileSplit()

Dim Workbook
Dim Worksheet
Dim fileName
Dim filePath
Dim objExcel
Dim objWorkbook
Dim rowCount
'Application.ScreenUpdating = False
'Application.Calculation = xlCalculationManual
MsgBox ("Hello World")
filePath = locateFile()


If filePath = "" Then
MsgBox "Operation canceled", vbcritical
Else
wscript.echo filePath
fileName = Mid(filePath, InStrRev(filePath, "") + 1)
wscript.echo fileName
End If

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Open(fileName)
Set objWorkbook = Activeworkbook

End Sub


Function locateFile()
locateFile = CreateObject("WScript.Shell").Exec( _
"mshta.exe ""about:<input type=file id=f>" & _
"<script>resizeTo(0,0);f.click();new ActiveXObject ('Scripting.FileSystemObject')" & _
".GetStandardStream(1).WriteLine(f.value);close();</script>""" _
).StdOut.ReadLine()


End Function


call FileSplit


many thanks in advance.










share|improve this question



















  • 3




    You are purposely extracting file name out of the full path to pass to Excel. Pass the full path instead.
    – GSerg
    Nov 9 at 12:59







  • 1




    IIRC Excel defaults to looking in your My Documents folder if you don't supply a path
    – oracle certified professional
    Nov 9 at 22:19










  • Thanks a ton .@GSerg, @oracle certified professional, its working fine now.
    – Vishy
    2 days ago














up vote
0
down vote

favorite












I started vb scripting very recently and compiled a vb script (of course googling) to open the excel sheet. However I am getting 800A03EC error - Sorry we could not find the excel sheet. Is it renamed/moved or deleted?



enter image description here



I can manually open the file manually without any error.



Is this because of document classification?



Here is my code



Option Explicit

Sub FileSplit()

Dim Workbook
Dim Worksheet
Dim fileName
Dim filePath
Dim objExcel
Dim objWorkbook
Dim rowCount
'Application.ScreenUpdating = False
'Application.Calculation = xlCalculationManual
MsgBox ("Hello World")
filePath = locateFile()


If filePath = "" Then
MsgBox "Operation canceled", vbcritical
Else
wscript.echo filePath
fileName = Mid(filePath, InStrRev(filePath, "") + 1)
wscript.echo fileName
End If

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Open(fileName)
Set objWorkbook = Activeworkbook

End Sub


Function locateFile()
locateFile = CreateObject("WScript.Shell").Exec( _
"mshta.exe ""about:<input type=file id=f>" & _
"<script>resizeTo(0,0);f.click();new ActiveXObject ('Scripting.FileSystemObject')" & _
".GetStandardStream(1).WriteLine(f.value);close();</script>""" _
).StdOut.ReadLine()


End Function


call FileSplit


many thanks in advance.










share|improve this question



















  • 3




    You are purposely extracting file name out of the full path to pass to Excel. Pass the full path instead.
    – GSerg
    Nov 9 at 12:59







  • 1




    IIRC Excel defaults to looking in your My Documents folder if you don't supply a path
    – oracle certified professional
    Nov 9 at 22:19










  • Thanks a ton .@GSerg, @oracle certified professional, its working fine now.
    – Vishy
    2 days ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I started vb scripting very recently and compiled a vb script (of course googling) to open the excel sheet. However I am getting 800A03EC error - Sorry we could not find the excel sheet. Is it renamed/moved or deleted?



enter image description here



I can manually open the file manually without any error.



Is this because of document classification?



Here is my code



Option Explicit

Sub FileSplit()

Dim Workbook
Dim Worksheet
Dim fileName
Dim filePath
Dim objExcel
Dim objWorkbook
Dim rowCount
'Application.ScreenUpdating = False
'Application.Calculation = xlCalculationManual
MsgBox ("Hello World")
filePath = locateFile()


If filePath = "" Then
MsgBox "Operation canceled", vbcritical
Else
wscript.echo filePath
fileName = Mid(filePath, InStrRev(filePath, "") + 1)
wscript.echo fileName
End If

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Open(fileName)
Set objWorkbook = Activeworkbook

End Sub


Function locateFile()
locateFile = CreateObject("WScript.Shell").Exec( _
"mshta.exe ""about:<input type=file id=f>" & _
"<script>resizeTo(0,0);f.click();new ActiveXObject ('Scripting.FileSystemObject')" & _
".GetStandardStream(1).WriteLine(f.value);close();</script>""" _
).StdOut.ReadLine()


End Function


call FileSplit


many thanks in advance.










share|improve this question















I started vb scripting very recently and compiled a vb script (of course googling) to open the excel sheet. However I am getting 800A03EC error - Sorry we could not find the excel sheet. Is it renamed/moved or deleted?



enter image description here



I can manually open the file manually without any error.



Is this because of document classification?



Here is my code



Option Explicit

Sub FileSplit()

Dim Workbook
Dim Worksheet
Dim fileName
Dim filePath
Dim objExcel
Dim objWorkbook
Dim rowCount
'Application.ScreenUpdating = False
'Application.Calculation = xlCalculationManual
MsgBox ("Hello World")
filePath = locateFile()


If filePath = "" Then
MsgBox "Operation canceled", vbcritical
Else
wscript.echo filePath
fileName = Mid(filePath, InStrRev(filePath, "") + 1)
wscript.echo fileName
End If

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Open(fileName)
Set objWorkbook = Activeworkbook

End Sub


Function locateFile()
locateFile = CreateObject("WScript.Shell").Exec( _
"mshta.exe ""about:<input type=file id=f>" & _
"<script>resizeTo(0,0);f.click();new ActiveXObject ('Scripting.FileSystemObject')" & _
".GetStandardStream(1).WriteLine(f.value);close();</script>""" _
).StdOut.ReadLine()


End Function


call FileSplit


many thanks in advance.







excel vbscript






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 12:48

























asked Nov 9 at 12:16









Vishy

2916




2916







  • 3




    You are purposely extracting file name out of the full path to pass to Excel. Pass the full path instead.
    – GSerg
    Nov 9 at 12:59







  • 1




    IIRC Excel defaults to looking in your My Documents folder if you don't supply a path
    – oracle certified professional
    Nov 9 at 22:19










  • Thanks a ton .@GSerg, @oracle certified professional, its working fine now.
    – Vishy
    2 days ago












  • 3




    You are purposely extracting file name out of the full path to pass to Excel. Pass the full path instead.
    – GSerg
    Nov 9 at 12:59







  • 1




    IIRC Excel defaults to looking in your My Documents folder if you don't supply a path
    – oracle certified professional
    Nov 9 at 22:19










  • Thanks a ton .@GSerg, @oracle certified professional, its working fine now.
    – Vishy
    2 days ago







3




3




You are purposely extracting file name out of the full path to pass to Excel. Pass the full path instead.
– GSerg
Nov 9 at 12:59





You are purposely extracting file name out of the full path to pass to Excel. Pass the full path instead.
– GSerg
Nov 9 at 12:59





1




1




IIRC Excel defaults to looking in your My Documents folder if you don't supply a path
– oracle certified professional
Nov 9 at 22:19




IIRC Excel defaults to looking in your My Documents folder if you don't supply a path
– oracle certified professional
Nov 9 at 22:19












Thanks a ton .@GSerg, @oracle certified professional, its working fine now.
– Vishy
2 days ago




Thanks a ton .@GSerg, @oracle certified professional, its working fine now.
– Vishy
2 days ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53225565%2f800a03ec-error-while-opening-excel-via-vb-script%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53225565%2f800a03ec-error-while-opening-excel-via-vb-script%23new-answer', 'question_page');

);

Post as a guest














































































Popular posts from this blog

How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

Darth Vader #20

Ondo