Fenrirshowl
Technical User
Hi all
Hopefully a quick one.
I am struggling with code which refers to Word from Excel.
I have the following:
What is the missing line to select all text in document "S22 EL.doc" please?
The document is open so I didn't think I would need to use ChDir etc in the code. This is a one-off so I am looking at something rough and ready.
The reason: a government department has provided a single line file Notepad file (which I've copied into Word) of thousands of characters (showing data on several hundred people) which I need to put into an Excel table. Each record is 80 characters long with no obvious delimiter. If I open it straight into Excel, I end up with one line of data only which is incomplete, hence the above.
I was simply going to define the whole document as a string variable, use LEFT to extract the first 80 characters, paste it in a cell, shorten the string and repeat. Once all 80 characters are in separate cells I can manipulate it as much as I need.
Thanks in advance
Hopefully a quick one.
I am struggling with code which refers to Word from Excel.
I have the following:
Code:
Sub importfromtxt()
Set wrdapp = GetObject(, "Word.Application")
Set wdDoc = wrdapp.Documents("S22 EL.doc")
End Sub
What is the missing line to select all text in document "S22 EL.doc" please?
The document is open so I didn't think I would need to use ChDir etc in the code. This is a one-off so I am looking at something rough and ready.
The reason: a government department has provided a single line file Notepad file (which I've copied into Word) of thousands of characters (showing data on several hundred people) which I need to put into an Excel table. Each record is 80 characters long with no obvious delimiter. If I open it straight into Excel, I end up with one line of data only which is incomplete, hence the above.
I was simply going to define the whole document as a string variable, use LEFT to extract the first 80 characters, paste it in a cell, shorten the string and repeat. Once all 80 characters are in separate cells I can manipulate it as much as I need.
Thanks in advance