Reputation: 129
I´m trying to open a file but it´s not working.
Workbook.Open C:\users\me\desktop\testfile.txt
I always get the error message: Run-time error '424': Object required
I just want to open a file. It´s not fixed if the file will be a exel, a txt, jpg or word file.
Should be as simple as possible.
Upvotes: 4
Views: 25194
Reputation: 1520
Are you trying to open the text file in excel ..
Then use opentext function
example
Workbooks.OpenText ("C:\users\me\desktop\testfile.txt")
Upvotes: 0
Reputation: 48989
To open a word, excel, jpg, pdf or any file, simple use:
Application.FollowHyperlink "path to file name"
Upvotes: 10
Reputation: 620
Create an Excel object first:
Dim xl as New Excel.Application
xl.Workbooks.Open("C:\users\me\desktop\testfile.txt")
xl.Visible = True
Upvotes: 0