Thread: [Solved] linking to excel from word
View Single Post
 
Old 06-08-2012, 12:37 AM
jillapass jillapass is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Dec 2011
Posts: 26
jillapass is on a distinguished road
Default

I need vba because it is part of a program to get various information to save the file.
I need to get the info from a particular cell in excel, which I can do, but my code which I have shown below opens the spreadsheet, but I get an error because it is already open.

I was pushing the info from excel into content control fields, but I had to move the fields into the header and I cannot find a way to refer to header content controls from excel, it worked fine when they were in the main body of the word document, but cannot see the header ones.

Dim exWb As Excel.Workbook
Dim objexcel As New Excel.Application
Set exWb = objexcel.Workbooks.Open("M:\care plan system\menu forms\office forms menu.xlsm")

Dim advisor
advisor = exWb.Sheets("menu").Cells(5, 4)
ThisDocument.SelectContentControlsByTitle("LAA").I tem.Range.Text = advisor
Reply With Quote