ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   method 'open text' of object 'workbooks' failed (https://www.excelbanter.com/excel-programming/339595-method-open-text-object-workbooks-failed.html)

tina

method 'open text' of object 'workbooks' failed
 
Hi
A user has a new pc running windows xp office 2000 and since cannot run a
macro I wrote which opens a .txt file manualy the file can be openned on new
pc .
I even record macro it recorded all key strokes and opened file but when I
tried recorded macro it failed with message
file cannot be accessed file maybe read only or read only location or server
document is on is not responding retry or cancel the vb message is run time
error 1004
method 'open text' of object 'workbooks' failed
as can be done manually why not as macro if I save file as .xls then write
macro macro works but do not want to do this

the macro i recorded is as follows
Sub Macro1()

Workbooks.OpenText Filename:="L:\SYMDATA\Amy\060905.txt",
Origin:=xlWindows _
, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 2),
Array( _
7, 1), Array(39, 1), Array(47, 1), Array(53, 1), Array(59, 1),
Array(70, 4), Array(83, 4), _
Array(95, 4), Array(107, 1), Array(117, 1), Array(123, 1),
Array(131, 1), Array(143, 1), _
Array(152, 1))
End Sub
any ideas would be much appreciated
Thanks Tina



Tom Ogilvy

method 'open text' of object 'workbooks' failed
 
Is the file in the L drive on the new PC?

Did you record the macro on the new PC. If not, try that.

--
Regards,
Tom Ogilvy

"tina" wrote in message
...
Hi
A user has a new pc running windows xp office 2000 and since cannot run a
macro I wrote which opens a .txt file manualy the file can be openned on

new
pc .
I even record macro it recorded all key strokes and opened file but when I
tried recorded macro it failed with message
file cannot be accessed file maybe read only or read only location or

server
document is on is not responding retry or cancel the vb message is run

time
error 1004
method 'open text' of object 'workbooks' failed
as can be done manually why not as macro if I save file as .xls then write
macro macro works but do not want to do this

the macro i recorded is as follows
Sub Macro1()

Workbooks.OpenText Filename:="L:\SYMDATA\Amy\060905.txt",
Origin:=xlWindows _
, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0,

2),
Array( _
7, 1), Array(39, 1), Array(47, 1), Array(53, 1), Array(59, 1),
Array(70, 4), Array(83, 4), _
Array(95, 4), Array(107, 1), Array(117, 1), Array(123, 1),
Array(131, 1), Array(143, 1), _
Array(152, 1))
End Sub
any ideas would be much appreciated
Thanks Tina





tina

method 'open text' of object 'workbooks' failed
 
Hi Tom
Yes the file is on L: drive and I recorded the macro on the new pc
I am a bit stump the problem seems to be the fact its a .txt file is there
any extra security for .txt files in vb?
Tina

"Tom Ogilvy" wrote:

Is the file in the L drive on the new PC?

Did you record the macro on the new PC. If not, try that.

--
Regards,
Tom Ogilvy

"tina" wrote in message
...
Hi
A user has a new pc running windows xp office 2000 and since cannot run a
macro I wrote which opens a .txt file manualy the file can be openned on

new
pc .
I even record macro it recorded all key strokes and opened file but when I
tried recorded macro it failed with message
file cannot be accessed file maybe read only or read only location or

server
document is on is not responding retry or cancel the vb message is run

time
error 1004
method 'open text' of object 'workbooks' failed
as can be done manually why not as macro if I save file as .xls then write
macro macro works but do not want to do this

the macro i recorded is as follows
Sub Macro1()

Workbooks.OpenText Filename:="L:\SYMDATA\Amy\060905.txt",
Origin:=xlWindows _
, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0,

2),
Array( _
7, 1), Array(39, 1), Array(47, 1), Array(53, 1), Array(59, 1),
Array(70, 4), Array(83, 4), _
Array(95, 4), Array(107, 1), Array(117, 1), Array(123, 1),
Array(131, 1), Array(143, 1), _
Array(152, 1))
End Sub
any ideas would be much appreciated
Thanks Tina






Tom Ogilvy

method 'open text' of object 'workbooks' failed
 
No. Try doing

if dir("L:\SYMDATA\Amy\060905.txt") < "" then
Workbooks.Open Filename:="L:\SYMDATA\Amy\060905.txt"
Else
msgbox "L:\SYMDATA\Amy\060905.txt doesn't exist"
End If

this uses the regular open command which should still work with a text file
although it won't parse the file.

--
Regards,
Tom Ogilvy



Using the regular open command.
"tina" wrote in message
...
Hi Tom
Yes the file is on L: drive and I recorded the macro on the new pc
I am a bit stump the problem seems to be the fact its a .txt file is there
any extra security for .txt files in vb?
Tina

"Tom Ogilvy" wrote:

Is the file in the L drive on the new PC?

Did you record the macro on the new PC. If not, try that.

--
Regards,
Tom Ogilvy

"tina" wrote in message
...
Hi
A user has a new pc running windows xp office 2000 and since cannot

run a
macro I wrote which opens a .txt file manualy the file can be openned

on
new
pc .
I even record macro it recorded all key strokes and opened file but

when I
tried recorded macro it failed with message
file cannot be accessed file maybe read only or read only location or

server
document is on is not responding retry or cancel the vb message is run

time
error 1004
method 'open text' of object 'workbooks' failed
as can be done manually why not as macro if I save file as .xls then

write
macro macro works but do not want to do this

the macro i recorded is as follows
Sub Macro1()

Workbooks.OpenText Filename:="L:\SYMDATA\Amy\060905.txt",
Origin:=xlWindows _
, StartRow:=1, DataType:=xlFixedWidth,

FieldInfo:=Array(Array(0,
2),
Array( _
7, 1), Array(39, 1), Array(47, 1), Array(53, 1), Array(59, 1),
Array(70, 4), Array(83, 4), _
Array(95, 4), Array(107, 1), Array(117, 1), Array(123, 1),
Array(131, 1), Array(143, 1), _
Array(152, 1))
End Sub
any ideas would be much appreciated
Thanks Tina








tina

method 'open text' of object 'workbooks' failed
 
thanks for help
but still get same message method 'open' of object 'workbooks' failed
Tina
"Tom Ogilvy" wrote:

No. Try doing

if dir("L:\SYMDATA\Amy\060905.txt") < "" then
Workbooks.Open Filename:="L:\SYMDATA\Amy\060905.txt"
Else
msgbox "L:\SYMDATA\Amy\060905.txt doesn't exist"
End If

this uses the regular open command which should still work with a text file
although it won't parse the file.

--
Regards,
Tom Ogilvy



Using the regular open command.
"tina" wrote in message
...
Hi Tom
Yes the file is on L: drive and I recorded the macro on the new pc
I am a bit stump the problem seems to be the fact its a .txt file is there
any extra security for .txt files in vb?
Tina

"Tom Ogilvy" wrote:

Is the file in the L drive on the new PC?

Did you record the macro on the new PC. If not, try that.

--
Regards,
Tom Ogilvy

"tina" wrote in message
...
Hi
A user has a new pc running windows xp office 2000 and since cannot

run a
macro I wrote which opens a .txt file manualy the file can be openned

on
new
pc .
I even record macro it recorded all key strokes and opened file but

when I
tried recorded macro it failed with message
file cannot be accessed file maybe read only or read only location or
server
document is on is not responding retry or cancel the vb message is run
time
error 1004
method 'open text' of object 'workbooks' failed
as can be done manually why not as macro if I save file as .xls then

write
macro macro works but do not want to do this

the macro i recorded is as follows
Sub Macro1()

Workbooks.OpenText Filename:="L:\SYMDATA\Amy\060905.txt",
Origin:=xlWindows _
, StartRow:=1, DataType:=xlFixedWidth,

FieldInfo:=Array(Array(0,
2),
Array( _
7, 1), Array(39, 1), Array(47, 1), Array(53, 1), Array(59, 1),
Array(70, 4), Array(83, 4), _
Array(95, 4), Array(107, 1), Array(117, 1), Array(123, 1),
Array(131, 1), Array(143, 1), _
Array(152, 1))
End Sub
any ideas would be much appreciated
Thanks Tina









Tom Ogilvy

method 'open text' of object 'workbooks' failed
 
It sounds like a permissions problem then - although that wouldn't explain
why the user can do it manually. You might need to get your network people
involved.

--
Regards,
Tom Ogilvy

"tina" wrote in message
...
thanks for help
but still get same message method 'open' of object 'workbooks' failed
Tina
"Tom Ogilvy" wrote:

No. Try doing

if dir("L:\SYMDATA\Amy\060905.txt") < "" then
Workbooks.Open Filename:="L:\SYMDATA\Amy\060905.txt"
Else
msgbox "L:\SYMDATA\Amy\060905.txt doesn't exist"
End If

this uses the regular open command which should still work with a text

file
although it won't parse the file.

--
Regards,
Tom Ogilvy



Using the regular open command.
"tina" wrote in message
...
Hi Tom
Yes the file is on L: drive and I recorded the macro on the new pc
I am a bit stump the problem seems to be the fact its a .txt file is

there
any extra security for .txt files in vb?
Tina

"Tom Ogilvy" wrote:

Is the file in the L drive on the new PC?

Did you record the macro on the new PC. If not, try that.

--
Regards,
Tom Ogilvy

"tina" wrote in message
...
Hi
A user has a new pc running windows xp office 2000 and since

cannot
run a
macro I wrote which opens a .txt file manualy the file can be

openned
on
new
pc .
I even record macro it recorded all key strokes and opened file

but
when I
tried recorded macro it failed with message
file cannot be accessed file maybe read only or read only location

or
server
document is on is not responding retry or cancel the vb message is

run
time
error 1004
method 'open text' of object 'workbooks' failed
as can be done manually why not as macro if I save file as .xls

then
write
macro macro works but do not want to do this

the macro i recorded is as follows
Sub Macro1()

Workbooks.OpenText Filename:="L:\SYMDATA\Amy\060905.txt",
Origin:=xlWindows _
, StartRow:=1, DataType:=xlFixedWidth,

FieldInfo:=Array(Array(0,
2),
Array( _
7, 1), Array(39, 1), Array(47, 1), Array(53, 1), Array(59,

1),
Array(70, 4), Array(83, 4), _
Array(95, 4), Array(107, 1), Array(117, 1), Array(123, 1),
Array(131, 1), Array(143, 1), _
Array(152, 1))
End Sub
any ideas would be much appreciated
Thanks Tina











tina

method 'open text' of object 'workbooks' failed
 
Thanks Tom
It was a novell issue latest version was not loaded once loaded everything
worked ok you helped me convince network people I was not the problem.
thanks for your time
Tina

"Tom Ogilvy" wrote:

It sounds like a permissions problem then - although that wouldn't explain
why the user can do it manually. You might need to get your network people
involved.

--
Regards,
Tom Ogilvy

"tina" wrote in message
...
thanks for help
but still get same message method 'open' of object 'workbooks' failed
Tina
"Tom Ogilvy" wrote:

No. Try doing

if dir("L:\SYMDATA\Amy\060905.txt") < "" then
Workbooks.Open Filename:="L:\SYMDATA\Amy\060905.txt"
Else
msgbox "L:\SYMDATA\Amy\060905.txt doesn't exist"
End If

this uses the regular open command which should still work with a text

file
although it won't parse the file.

--
Regards,
Tom Ogilvy



Using the regular open command.
"tina" wrote in message
...
Hi Tom
Yes the file is on L: drive and I recorded the macro on the new pc
I am a bit stump the problem seems to be the fact its a .txt file is

there
any extra security for .txt files in vb?
Tina

"Tom Ogilvy" wrote:

Is the file in the L drive on the new PC?

Did you record the macro on the new PC. If not, try that.

--
Regards,
Tom Ogilvy

"tina" wrote in message
...
Hi
A user has a new pc running windows xp office 2000 and since

cannot
run a
macro I wrote which opens a .txt file manualy the file can be

openned
on
new
pc .
I even record macro it recorded all key strokes and opened file

but
when I
tried recorded macro it failed with message
file cannot be accessed file maybe read only or read only location

or
server
document is on is not responding retry or cancel the vb message is

run
time
error 1004
method 'open text' of object 'workbooks' failed
as can be done manually why not as macro if I save file as .xls

then
write
macro macro works but do not want to do this

the macro i recorded is as follows
Sub Macro1()

Workbooks.OpenText Filename:="L:\SYMDATA\Amy\060905.txt",
Origin:=xlWindows _
, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0,
2),
Array( _
7, 1), Array(39, 1), Array(47, 1), Array(53, 1), Array(59,

1),
Array(70, 4), Array(83, 4), _
Array(95, 4), Array(107, 1), Array(117, 1), Array(123, 1),
Array(131, 1), Array(143, 1), _
Array(152, 1))
End Sub
any ideas would be much appreciated
Thanks Tina













All times are GMT +1. The time now is 08:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com