Inventor vba modify OLE link

Inventor vba modify OLE link

sgodonVEAP9
Contributor Contributor
272 Views
2 Replies
Message 1 of 3

Inventor vba modify OLE link

sgodonVEAP9
Contributor
Contributor

Hi guys, i have an inventor sheet (in my templates) that has an ole link in it (PLANIF_EXCEL.xlsm): (see picture1)

 

Picture1.PNG

 

After saving the new .idw, here's what's in the folder (see picture2) :

 

picture2.PNG

 

 

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) :

Picture3.PNG

 

 

I need to replace the source link. It works fine manually (right click --> modify source). Here's the the result (see picture4): 

picture4.PNG

 

Any ideas on how to replace the source by code? I hope I explained clearly. thanks!

0 Likes
273 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor

First delete the existing.

Than add the newer one.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

sgodonVEAP9
Contributor
Contributor

The problem with adding a new link is that I cant resize or move it as I need.. 😞 

0 Likes