×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Linking Spreadsheet Data to text file

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

RE: Linking Spreadsheet Data to text file

Draw a button on your sheet with the forms toolbar.
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

All you need to do is "copy" the spread sheet and within word, click edit and paste special, then click "paste link" then ok.  The spead sheet is now in word.  What ever you do to the spread sheet will automatially be updated in the word document.

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources