ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Opening a text file in excel (https://www.excelbanter.com/excel-discussion-misc-queries/30391-opening-text-file-excel.html)

Opyuse

Opening a text file in excel
 
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?



Opyuse

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.

Opyuse

I've add the excel libary to the project but it still won't open.

This time however there is no error message.

Opyuse

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!

"Opyuse" wrote:

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?



bj

try <data< import external data and follow the wizard.

"Opyuse" wrote:

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!

"Opyuse" wrote:

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?




All times are GMT +1. The time now is 06:36 AM.

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