kmjones
05-14-2010, 12:28 PM
I'm attempting to link cells in an excel file into a word document. So the user would fill out the excel document with the necessary data and then could click a macro in word that would pull those numbers into a word "letter" so to speak in the appropriate locations.
I've found some help using bookmarks to mark the "places" for the excel data to go but I am having trouble with the code itself.
Here is what I've got so far:
Sub AutoFill()
Dim WB As Excel.Workbook
Set WB = GetObject("T:\Folder\File.xls")
Selection.GoTo What:=wdGoToBookmark, Name:="Title"
Selection.TypeText (WB.Sheets("Database").Range("C4"))
Set WB = Nothing
End Sub
I'm having issues with the GetObject among other things I'm sure....
Any help from more experienced users would be greatly, greatly appreciated.
Thank you very much!
Krissy
I've found some help using bookmarks to mark the "places" for the excel data to go but I am having trouble with the code itself.
Here is what I've got so far:
Sub AutoFill()
Dim WB As Excel.Workbook
Set WB = GetObject("T:\Folder\File.xls")
Selection.GoTo What:=wdGoToBookmark, Name:="Title"
Selection.TypeText (WB.Sheets("Database").Range("C4"))
Set WB = Nothing
End Sub
I'm having issues with the GetObject among other things I'm sure....
Any help from more experienced users would be greatly, greatly appreciated.
Thank you very much!
Krissy