I have received following error while trying to do replace a style set in word document. This will replace the styles in multiple document, currently i am building in visual studio 2012. kindly help me on this.
Error: Warning 1 Could not determine the dependencies of the COM reference "WordClientPkgLib". Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)) doc replacing
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim word_app As Microsoft.Office.Interop.Word.Application
Dim word_doc As Microsoft.Office.Interop.Word.Document
word_app = CreateObject("Word.Application")
word_app.Visible = True
Dim path As String = Me.TextBox1.Text
Dim dir As New DirectoryInfo(path)
Dim comnothing As Object
comnothing = New Runtime.InteropServices.UnknownWrapper(Nothing)
word_app = comnothing
word_doc = comnothing
For Each f As FileInfo In dir.GetFiles("*.docx")
word_doc = word_app.Documents.Open(path & "\" & f.Name)
word_doc.ApplyQuickStyleSet("Transcript_v4")
word_app.Selection.WholeStory()
word_app.Selection.Style = word_doc.Styles("Normal Continuing")
word_app.Selection.HomeKey()
word_app.Selection.Style = word_doc.Styles("Normal Initial")
word_doc.Save()
word_doc.Close()
'MsgBox(f.Name)
Next f
MsgBox("Completed processing the files...")
word_app.Quit()
End Sub
User contributions licensed under CC BY-SA 3.0