DThib

Active Member
Joined
Mar 19, 2010
Messages
464
Office Version
  1. 365
Platform
  1. Windows
The snippet of code below is giving me fits.
I have a couple of input boxes putting in the variable name and the Stub1 is the path and the name of the file.

It is throwing an error when I point to the network.
"Run-time error '1004':
Method 'OpenText' of Object 'Workbooks' failed.

I cannot find anything that talks about this error in Excel 365
Code:
workbooks.OpenText Filename:=Stub1, Origin:=65001, StartRow:=1, DataType:=xlDelimited, _
        Comma:=True, FieldInfo:=Array(Array(1, 2), Array(2, 1), Array(3, 1), Array(4, 1), _
        Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), _
        Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15, 1)), TrailingMinusNumbers:=True

What's going on?

Help, please!

Dthib
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Thanks for the suggestion.

Same result, though.


DThib
 
Upvote 0
It works now!
The server addresswas throwng an error that stalled at this step since it could not resolve itself.

DThib
 
Upvote 0
Sorry I didn't come back on...to be honest, I had never seen Workbook.OpenText and when you said that .Open didn't work either, I didn't really have anything useful to add. I'm glad you got it working though :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,638
Messages
6,120,674
Members
448,977
Latest member
moonlight6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top