Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Macro Parts list into Word with Thumbnail Script

5 REPLIES 5
Reply
Message 1 of 6
stevenL2ZFM
1644 Views, 5 Replies

Macro Parts list into Word with Thumbnail Script

stevenL2ZFM
Advocate
Advocate

Hello all,

 

I have found this script to generate a parts list with a thumbnail. It places the parts list into a new word document. Is there any VBscript pro who can help me modify the code just a bit?

 

I am looking to change the script to open a template file instead of a blank new word document.

Script is attached as script.txt 

 

Steven.

0 Likes

Macro Parts list into Word with Thumbnail Script

Hello all,

 

I have found this script to generate a parts list with a thumbnail. It places the parts list into a new word document. Is there any VBscript pro who can help me modify the code just a bit?

 

I am looking to change the script to open a template file instead of a blank new word document.

Script is attached as script.txt 

 

Steven.

5 REPLIES 5
Message 2 of 6

Mark.Lancaster
Consultant
Consultant

@stevenL2ZFM

 

I will tag @Curtis_Waguespack and he should be able to assist and/or you can post over in the Inventor Customization Forum

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

@stevenL2ZFM

 

I will tag @Curtis_Waguespack and he should be able to assist and/or you can post over in the Inventor Customization Forum

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

Message 3 of 6

Curtis_Waguespack
Consultant
Consultant

Hi stevenL2ZFM,

 

I didn't test it, but I think something like this should work.

 

Replace this:

 

 

    ' Create a new Word document.
    Dim wordDoc As Word.Document
    Set wordDoc = wordApp.Application.Documents.Add

 

With something like this:

 

    sWordTemplate = "C:\Program Files\Microsoft Office" _
    & "\Templates\Memos\Professional Memo.dot"
    
    ' Create a new Word document.
    Dim wordDoc As Word.Document
    Set wordDoc = wordApp.Application.Documents.Add(Template:=sWordTemplate)

 

Source:

https://msdn.microsoft.com/en-us/library/office/ff845011.aspx

 

Also as Mark.Lancaster mentioned Also just as a tip, you can search and ask programming questions of this type are best placed on the Inventor Customization forum:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

0 Likes

Hi stevenL2ZFM,

 

I didn't test it, but I think something like this should work.

 

Replace this:

 

 

    ' Create a new Word document.
    Dim wordDoc As Word.Document
    Set wordDoc = wordApp.Application.Documents.Add

 

With something like this:

 

    sWordTemplate = "C:\Program Files\Microsoft Office" _
    & "\Templates\Memos\Professional Memo.dot"
    
    ' Create a new Word document.
    Dim wordDoc As Word.Document
    Set wordDoc = wordApp.Application.Documents.Add(Template:=sWordTemplate)

 

Source:

https://msdn.microsoft.com/en-us/library/office/ff845011.aspx

 

Also as Mark.Lancaster mentioned Also just as a tip, you can search and ask programming questions of this type are best placed on the Inventor Customization forum:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 4 of 6

stevenL2ZFM
Advocate
Advocate

I wasn't able to get it to work... maybe my coding skills are too elementary 😄

 

0 Likes

I wasn't able to get it to work... maybe my coding skills are too elementary 😄

 

Message 5 of 6

MechMachineMan
Advisor
Advisor

Try this. If it's truly .vbs, you can't declare any complicated object types beyond the basic ones.

 

 

    sWordTemplate = "C:\Program Files\Microsoft Office" _
    & "\Templates\Memos\Professional Memo.dot"
    
    Dim wordDoc
    Set wordDoc = wordApp.Application.Documents.Add(Template:=sWordTemplate)

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

Try this. If it's truly .vbs, you can't declare any complicated object types beyond the basic ones.

 

 

    sWordTemplate = "C:\Program Files\Microsoft Office" _
    & "\Templates\Memos\Professional Memo.dot"
    
    Dim wordDoc
    Set wordDoc = wordApp.Application.Documents.Add(Template:=sWordTemplate)

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 6 of 6

stevenL2ZFM
Advocate
Advocate

Thanks for the reply. This is not working either.

 

But i found a new problem with the add-in 😞  After running the add-in, all fields within the parts list become static values and not associated with the part referenced.

 

There were two versions of this code from the website I found it on.

http://modthemachine.typepad.com/my_weblog/2010/02/parts-list-with-thumbnail-image.html

 

One installs as an add-in (which works but has the problem listed above)

 

The other is copied then pasted into a module. It worked a few times, then it just stopped working and has a compiling error (see screenshot error.jpg).

 

Maybe the error is a quick fix and I can try to implement the template coding you provided?

 

Thanks for the help !

 

Steven

 

0 Likes

Thanks for the reply. This is not working either.

 

But i found a new problem with the add-in 😞  After running the add-in, all fields within the parts list become static values and not associated with the part referenced.

 

There were two versions of this code from the website I found it on.

http://modthemachine.typepad.com/my_weblog/2010/02/parts-list-with-thumbnail-image.html

 

One installs as an add-in (which works but has the problem listed above)

 

The other is copied then pasted into a module. It worked a few times, then it just stopped working and has a compiling error (see screenshot error.jpg).

 

Maybe the error is a quick fix and I can try to implement the template coding you provided?

 

Thanks for the help !

 

Steven

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report