Hi I want to open a Visio document template from within my Excel spreadsheet and search and replace set values with values from my Excel spreadsheet.
For Example Cell M33 contains the Customer Name and I want to open the file Visio_template.vsd and find and replace the string [Customer] with the value of cell M33.
For the next bit I did the very same thing as i have working for a Word document...Code:Dim VisioApp As Object vfilepath = Application.ActiveWorkbook.Path Set objv = CreateObject("Visio.Application") objv.Visible = True
How do I achieve this in a Visio document?Code:Set objWord = CreateObject("Word.Application") objWord.Visible = True Set objDoc = objWord.documents.Open(seedsdd) Set objSelection = objWord.Selection Const wdReplaceAll = 2 ' Customer Name objSelection.Find.Text = "[Customer]" objSelection.Find.Forward = True objSelection.Find.MatchWholeWord = True objSelection.Find.Replacement.Text = Worksheets("Calculator").Range("M" & 33).Value objSelection.Find.Execute , , , , , , , , , , wdReplaceAll
Thanks
Steve


Reply With Quote
