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?
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
add a comment |
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?
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
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
add a comment |
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?
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
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?
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
excel vbscript
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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