Linking Spreadsheet Data to text file
Linking Spreadsheet Data to text file
(OP)
Hello,
Is it possible to have data in an Excel spread sheet that will be linked to a word document or word text file so that if changes are made to values in the spread sheet, they will also occur in the .doc or .txt file?
I have weights in a Bill Of Material spreadsheet that I want to link to a drawing file.
Michael
Is it possible to have data in an Excel spread sheet that will be linked to a word document or word text file so that if changes are made to values in the spread sheet, they will also occur in the .doc or .txt file?
I have weights in a Bill Of Material spreadsheet that I want to link to a drawing file.
Michael





RE: Linking Spreadsheet Data to text file
Copy and paste this code into a module
Right click on the button then assign the macro.
Press the button, hey presto
Option Base 1 'Set arrays to start at 1
Sub Getdata()
Dim ColumnList() As String
' Change this to your file path
MyDataFile = "C:\temp\tmp.txt"
Open MyDataFile For Output As #1
' Get each value from column A
For i = 1 To 65536
' If cell empty then exit loop
' Cells(Row, Column),
If ThisWorkbook.Sheets("Sheet1").Cells(i, 1) = "" Then Exit For
' Redimension the array for each row
ReDim Preserve ColumnList(i)
' Assign the value of the current
' row the current array element
ColumnList(i) = ThisWorkbook.Sheets("Sheet1").Cells(i, 1)
'Write data to file
Print #1, ColumnList(i)
Next i
'Close file
Close #1
End Sub
Hope this helps
RE: Linking Spreadsheet Data to text file
Nigel Waterhouse & Associates
Aeronautical Consulting Engineers
Transport Canada and F.A.A approval & certification of fixed and rotor wing aircraft alterations: Structures, Systems, Powerplants and electrical. FAA PMA, TC PDA.
n_a_waterhouse@hotmail.com