Hi there!
Ill do my best to try to explain the process im struggling with. feel free to ask followupp Qs.
I have A excel workbook with data that i work in. to this i have a button on first sheet that has a macro connected that i cant get to work.
The Macro should rund a wordmacro file.
The word file works as follows. When i run the word file "Intern syn NCC_Hornbach.dotm" in the folder. ( by dubbelklicking it) it runs, then gets a standard template from another file called "Intern_syn_NCC.dotm" och makes a new document with the standard template as page one. then it looks in an excel file wich has say 10 rows with data. and populates the first page with row one. then gets the template again and makes page 2, populates it with data from row 2 in the excel fil and so on untill page 10.
then the word file "Intern syn NCC_Hornbach.dotm" closes leavin a new document with no title open with 10 templatepages populated with data from the 10 rows it got from the excel datafile.
My problem is that when i run the macro. i get runtime error and can klick terminate. allthough the macro opens the wordmacro file.
but doesnt runt it. so it remains open with 1 page.
the code i use is as follows
Sub GetWordDoc()
Dim myDocPath As Selection
'Opens a Word Document from Excel
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
'Change the directory path and file name to the location
'of your document
Set objDoc.Selection = objWord.Documents.Open(Filename:=ThisWorkbook.Path & "\Intern syn NCC_Hornbach.dotm")
End Sub
how do i solve this so the macro just runs the wordfile, and doesnt open in? so it will work as it does when i dubble klick it in the folder?
Many thnx in advance and i hope its not to confusing!
cheers
Bookmarks