ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is it possible to activate a txt document in excel code? (https://www.excelbanter.com/excel-programming/293377-possible-activate-txt-document-excel-code.html)

Together[_10_]

Is it possible to activate a txt document in excel code?
 
Hi,

I have some excel file, with some number in excel cells. Each singl
figure in some cells. Of couse, there are some cells without an
content. My objective, is to let the figure in cells to be character i
text file, and let null cell to be space in text file. I can us
variables to transfer the data in excel to text. But there are anothe
problem appearing. I can not open text file in excel VB editor. Here i
my code:

Sub macr()
Dim i, j As Integer
Dim value As String

For i = 1 To 65
For j = 1 To 80
value = ActiveWorkbook.Sheets(1).Cells(i, j).value
Documents.Open Filename:="D:\VB\Code for TRF"
Activedocument.Paragraphs(i).Range.Characters(j).T ext = value

Next j
Next i

End Sub

It seems that the function "Document. Open" is not validaty, and I ca
not open the "Code for TRF" file in the code. How to modify the code
Thank you

--
Message posted from http://www.ExcelForum.com


Darren Hill[_2_]

Is it possible to activate a txt document in excel code?
 
The following page gives macros for using text files effectively - I had a
problem similar to yours earlier this week.
http://www.cpearson.com/excel/imptext.htm

--
Darren
"Together " wrote in message
...
Hi,

I have some excel file, with some number in excel cells. Each single
figure in some cells. Of couse, there are some cells without any
content. My objective, is to let the figure in cells to be character in
text file, and let null cell to be space in text file. I can use
variables to transfer the data in excel to text. But there are another
problem appearing. I can not open text file in excel VB editor. Here is
my code:

Sub macr()
Dim i, j As Integer
Dim value As String

For i = 1 To 65
For j = 1 To 80
value = ActiveWorkbook.Sheets(1).Cells(i, j).value
Documents.Open Filename:="D:\VB\Code for TRF"
Activedocument.Paragraphs(i).Range.Characters(j).T ext = value

Next j
Next i

End Sub

It seems that the function "Document. Open" is not validaty, and I can
not open the "Code for TRF" file in the code. How to modify the code.
Thank you.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:37 PM.

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