Excel cell to Word Autotext
Hello hopefully somebody can help me out. I am trying to get some excel data that I read into VBA to a Word template with Autotext or Form Fields in the template. I want to make certain Form Fields equal to the data from Excel. I look around and try a different way to do it but always get different runtime errors. I am a just learning how to use VBA in Word but I am decent in VBA in Excel. Well there the last according to some site suppose to work.
ExcelInformation = WordDoc.FormFields(WordDoc.Bookmarks(?x?).Name).Result
But I get a runtime error from it about no Object.
Well any help anybody can give will be great. Anybody got a opioion on a good book to learn VBA in Word I take that also. Thanks again for any help anybody can give thanks.
Excel cellto Word Autotext
Thanks for the help so far i try to download the zip file and understand the code, but some reason i cant figure out the code for now. But i understand most of it.
But the ExcelInfo can be numbers and Test, so i guess they excel info would be variant file type. The excel info is name and adress and number information of a company or person. So all that info will need to be put in a Word Template for email and saving the info in paper files for people to use for contact information. The path is the actual path i just used that to show there was a path for the document.
I just want to Thanks for the help, since i still learning how to write VBA for word everything ben helpful. If anybody got a good book to recommend to learn how to write VBA for word I would greatful for that.
Excel to word template (mistake i caught)
Hey Everybody I caught a mistake it suppose to be ActiveDocument not ActiveDocuments. I changed it and i get the rentime of 424-Object required. So if anybody can figure out what i am doing wrong or point some where to go i would be gratefully. Thanks again.
Quote:
Originally Posted by josephemery
Hello Everybody
I am writing the code for the program and I am getting a run time error of 438- object doesn?t support this method or property. What it look likes is that Excel VBA doesn?t recognizes ActiveDocument command. I am not sure, but here my code. If it helpfully I am using Office 2003. ExcelInfo can be either string or number depends on the info.
[VBA]
Dim WdApps As Object
Set WdApps = CreateObject("Word.Application")
WdApps.documents.Open "path"
WdApps.Visible = True
Set Activedocument = WdApps
'put the excel info the word doc
Set ExcelInfo = Activedocuments.Bookmarks("name").Range
[/VBA]
Any help given will be greatly appreciated. Thanks
Joseph