How to import data from .txt file into excel sheet using com interface?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Sabestian Caine
Posts: 248
Joined: 12 Apr 2015, 03:53

How to import data from .txt file into excel sheet using com interface?

04 Dec 2016, 04:59

friends i have a .txt file whose data i want to be imported in excel sheet. In that .txt file there are 12 columns of data which are separated by tabs. for this i made a simple script to automate mouse clicks, but it takes much time to import data from .txt file into excel sheet by this script as there are only mouse clicks and mouse drags in my script. You can see the sample of my .txt file here-
http://www.filetolink.com/08a5d71a51

or you can see the snap shoot of .txt file here-
http://imgur.com/a/PXQLN

i want to import such .txt files into excel sheet with the help of com interface. Please help me.

THANKS.
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
kon
Posts: 1760
Joined: 29 Sep 2013, 17:11

Re: How to import data from .txt file into excel sheet using com interface?

04 Dec 2016, 07:58

Maybe try SafeArrayFromStr.
The example splits text into rows using linefeeds (`n) and columns using commas (,). You would just change the commas to tabs `t.
User avatar
Sabestian Caine
Posts: 248
Joined: 12 Apr 2015, 03:53

Re: How to import data from .txt file into excel sheet using com interface?

04 Dec 2016, 10:30

kon wrote:Maybe try SafeArrayFromStr.
The example splits text into rows using linefeeds (`n) and columns using commas (,). You would just change the commas to tabs `t.

Thanks dear kon for your good answer. Please tell me how should i use these codes to split data into rows and columns. as i have copied all data of .txt file into clipboard now how to use these codes to split the data into rows and columns and to paste it into excel sheet.

there are two sets of codes in this link-
https://autohotkey.com/boards/viewtopic.php?f=6&p=95606

first are these-

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


and second are these-

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Kindly tell me how could i use these codes to split my data of .txt file into rows and columns.

Thanks..
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
User avatar
Sabestian Caine
Posts: 248
Joined: 12 Apr 2015, 03:53

Re: How to import data from .txt file into excel sheet using com interface?

04 Dec 2016, 11:59

Please tell me how to set these vba codes to work in ahk environment for importing data form .txt file-

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
Guest

Re: How to import data from .txt file into excel sheet using com interface?

04 Dec 2016, 13:08

Sabestian Caine wrote:You can see the sample of my .txt file here-
http://www.filetolink.com/08a5d71a51

please post sample text in code box like this:

Code: [Select all] [Download] (Untitled.txt)GeSHi © Codebox Plus

friends i have a .txt file whose data i want to be 
imported in excel sheet. In that .txt file there are 12 columns of data which
are separated by tabs. for this i made a simple script to automate mouse
clicks, but it takes much time to import data from .txt file into excel sheet
by this script as there are only mouse clicks and mouse drags in my script.

no download or login required.
kon
Posts: 1760
Joined: 29 Sep 2013, 17:11

Re: How to import data from .txt file into excel sheet using com interface?

04 Dec 2016, 14:34

Most of the VBA code from the macro recorder is redundant; a lot of these lines are probably not required. ie: The Excel macro recorder has a habit of setting properties to their default values (or whatever arbitrary values you have set at the time of recording).

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
Sabestian Caine
Posts: 248
Joined: 12 Apr 2015, 03:53

Re: How to import data from .txt file into excel sheet using com interface?

10 Dec 2016, 07:45

kon wrote:Most of the VBA code from the macro recorder is redundant; a lot of these lines are probably not required. ie: The Excel macro recorder has a habit of setting properties to their default values (or whatever arbitrary values you have set at the time of recording).

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



thanks dear kon...........
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 20 guests