Opening a text file in excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using a visual basic 6.0 I have created a tab delimiated text file, which is
an export of a Query.

I what to then open this file automaticly after it is created in Excel.

I've looked about and can't find anyone with a simple answer. Most questions
involve macros but I'm working from a vb application to excel.

How do I open Excel?
 
Dim xlTmp As Excel.Application

Set xlTmp = New Excel.Application
xlTmp.Workbooks.Open Fname$

I have tried the following but I get the error message:
"User-defined type not defined"

Fname$ Contains the path of the text file.
 
I've add the excel libary to the project but it still won't open.

This time however there is no error message.
 
For some reason when I us this method the file is uneditable.

When I try to open it manually I'm told that another user has set it this way.

I've added to the code with

test = xlTmp.Workbooks.Open(Fname$, , 0, 1, , , , , , True)

which if I read the help right should have set it to editable.

What is going on?
And can someone please answer me!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top