Source linked Excel location changes according to new Project Help

Source linked Excel location changes according to new Project Help

Anonymous
Not applicable
591 Views
7 Replies
Message 1 of 8

Source linked Excel location changes according to new Project Help

Anonymous
Not applicable

I have an Assembly that it is driven by an Excel file, I have the Template in a server location and the Excel as well.

My problem is that when I create a new Assembly is copied to a new folder but the Excel retained the Template location.

How can I change the Source linked Excel location to the new Project folder?

Please let me know if this should be done programmatically with my *.sln (Visual Studio) or within the iLogic coding.

All suggestion is valid since I'm new with Inventor in this respect.

I am running Inventor 2019

Visual Studio 2017 Pro

Thank you all

0 Likes
Accepted solutions (1)
592 Views
7 Replies
Replies (7)
Message 2 of 8

Sergio.D.Suárez
Mentor
Mentor

Hi, have you tried changing the excel file path by selecting it in the assembly and right clicking as the image shows?

 

1.jpg

Also in the forum there is an ilogic rule to change the excel path of all the reference files of the main assembly.

https://forums.autodesk.com/t5/inventor-customization/ilogic-change-source-of-embeded-excel-sheet/m-...
I hope this helps. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 8

Anonymous
Not applicable

Hi Sergio,

I know I can do it inside Inventor, but It happened that I replace it in one Assembly but it didn't replace it in all the parts.

Secondly, I am automating everything with vb net.

So the user-designer will open the assembly, it will verify it and validate everything runs smoothly. no need to do anything manually.

I found a macro just a minutes ago, in fact in this post.

So I just want to implemented inside my Application, without the need to open or look for the files.

Any idea how to assemble macro inside vb net is welcome.

And of course thank you for your help in this matter.

I will keep you post it if I found the final solution.

Regards, Sam

0 Likes
Message 4 of 8

Anonymous
Not applicable

Sergio,

I forgot to mention something,

I am looking to know:

A) The iLogic rule (Macro) needs to run when the Inventor is running? or

B) Can I run the Macro within the vb net coding?

I preferred the second one but I also know I can trigger the macro once the Assembly open as well.

 

Please advise,

Thanks

 

0 Likes
Message 5 of 8

johnsonshiue
Community Manager
Community Manager

Hi! I believe changing such reference path needs to be done within Inventor (API, Apprentice Server or Inventor Server). You cannot just edit the file outside of Inventor.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 6 of 8

Anonymous
Not applicable

Correct Johnsonshiue,

I am doing using vb net.

I am looking for the code to use it and make the changes automatically.

If you kindly know how to do it? do you mind to share it with me?

Thanks you so much.

Best Regards,

Sam

0 Likes
Message 7 of 8

JaneFan
Autodesk
Autodesk
Accepted solution

Hi @Anonymous , 

 

There is no direct way to change the reference linked file in API, but we can delete the original reference, and add a new reference with specifying new project location. 

Please take below API code as reference and make it triggered in some certain events as your need: 

Dim oDocument As Document
Set oDocument = ThisApplication.ActiveDocument
'Delete original reference
Dim oD As ReferencedOLEFileDescriptor
Set oD = oDocument.ReferencedOLEFileDescriptors.ItemByName("aa.xlsx")
oD.Delete

'Add new reference with updated project location
Call oDs.Add(ProjectLocation + "\aa.xlsx", kOLEDocumentLinkObject)




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 8 of 8

Anonymous
Not applicable

JaneFan,

Thank you so much for your respond in this matter.

I will check it out and I will verify with the other two I found and see which one works better.

I found out that working directly with the copy code it came out to the right reference source for the 3rd Party location.

I also found the iLogic coding in conjunction with this issue.

I will share it later for the benefit of others.

Best Regards,

Sam

 

0 Likes