Inventor vba modify OLE link
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys, i have an inventor sheet (in my templates) that has an ole link in it (PLANIF_EXCEL.xlsm): (see picture1)
After saving the new .idw, here's what's in the folder (see picture2) :
I have a code that counts the number of .xlsm files in the folder than it copies the sheet in inventor until it matches the number of .xlsm files.
Dim FolderPath As String, path As String, count As Integer
FolderPath = Left(ThisApplication.ActiveDocument.FullFileName, InStrRev(ThisApplication.ActiveDocument.FullFileName, "\"))
path = FolderPath & "\*.xlsm"
FileName = Dir(path)
Do While FileName <> ""
count = count + 1
FileName = Dir()
Loop
For i = 1 To count - 2
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim tmpDoc As DrawingDocument
Set tmpDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, , True)
Dim newSheet As Sheet
Set newSheet = oDoc.ActiveSheet.CopyTo(tmpDoc)
Call newSheet.CopyTo(oDoc)
tmpDoc.Close (True)
Next
Here's the result (see picture3) :
I need to replace the source link. It works fine manually (right click --> modify source). Here's the the result (see picture4):
Any ideas on how to replace the source by code? I hope I explained clearly. thanks!