Ilogic not reading my Excell file.

Ilogic not reading my Excell file.

JorisSteurs1246
Advocate Advocate
1,300 Views
22 Replies
Message 1 of 23

Ilogic not reading my Excell file.

JorisSteurs1246
Advocate
Advocate

Hi,

 

Does anyone has any clue why ilogic is not reading my excell file.

When I copy the path from the rule, it will open correctly when i paste it in file explorer.

Screenshots of error box are attached.

 

Ilogic below.

 

 

SyntaxEditor Code Snippet

'---------start of iLogic code---------

StartRule:'read excel file

GoExcel.Open("F:\JorisTest.xlsx")



'index row 2 through 100
For rowPN = 2 To 100
'find first empty cell in column B
 If (GoExcel.CellValue("B" & rowPN) = "") Then
'create a variable for the cell value that is one row less than 'the empty cell row
    lastPN = GoExcel.CellValue("B" & rowPN - 1)
      lastDesc = GoExcel.CellValue("C" & rowPN- 1)
         Exit For
 End If
  
Next

'show results and ask user to confirm results
question = MessageBox.Show("PN: " & lastPN & vbLf _
&"Description: " & lastDesc & vbLf _
& "Is this correct?", "iLogic from Excel", MessageBoxButtons.YesNo )

'if answer is no
If question = vbNo Then

Goto StartRule
'if answer is yes exit rule
Else End If

 

 

0 Likes
1,301 Views
22 Replies
Replies (22)
Message 2 of 23

MechMachineMan
Advisor
Advisor

GoExcel.Open("filename", “sheetname”)

 

http://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2014/...


--------------------------------------
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
Message 3 of 23

JorisSteurs1246
Advocate
Advocate

I did include the sheetname in my first attempts but when it didn't work, I started reading in the online help where is says that if there is no sheetname in the path, Inventor thakes sheet1 by default. So I gave this a try also, but no luck.  ( Sheet1 is also the name of Sheet1 in my file, so that should be OK )

0 Likes
Message 4 of 23

Owner2229
Advisor
Advisor

Hi, at the end of your rule you must have this code below. So it saves and closes the Excel table. Maybe that is the problem.

 

GoExcel.Save
GoExcel.Close

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 5 of 23

JorisSteurs1246
Advocate
Advocate

No adding this code didn't help, file is not recognized. Maybe its a Widows problem?  Are ther any tests I can do to pinpoint the issue?

Maybe it can be because of the fact that I upgraded fom office 2003 to Office 2010 while Inventor was already installed?

0 Likes
Message 6 of 23

MechMachineMan
Advisor
Advisor
http://forums.autodesk.com/t5/inventor-customization/ilogic-and-excel/m-p/4855153/highlight/true#M48...

--------------------------------------
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
Message 7 of 23

MechMachineMan
Advisor
Advisor
http://forums.autodesk.com/t5/inventor-customization/interface-not-registered-broken-connection-with...

--------------------------------------
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
Message 8 of 23

JorisSteurs1246
Advocate
Advocate

Copied the IPT and Excel file to another machine and still a problem although the error message is different.

 

0 Likes
Message 9 of 23

MechMachineMan
Advisor
Advisor

Well, what's the error there?


--------------------------------------
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
Message 10 of 23

JorisSteurs1246
Advocate
Advocate

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at iLogic.GoExcel.SetCurrentSheet(String fileName, String sheetName)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

0 Likes
Message 11 of 23

MechMachineMan
Advisor
Advisor
Try copy pasting the data to a new excel file on this new computer and
re-running. Looks like excel issues.

--------------------------------------
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
Message 12 of 23

JorisSteurs1246
Advocate
Advocate

Did so already earlier,  but gave it another try right now, with this outcome.

 

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at iLogic.GoExcel.SetCurrentSheet(String fileName, String sheetName)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

0 Likes
Message 13 of 23

MechMachineMan
Advisor
Advisor

Try this simple rule with a new excel file and see how that goes:

 

 

Dim Loc as String = "C:/" ' Change to actual file location

 

Worksheet = Loc

Sheetno = ("Sheet1")

GoExcel.Open(Worksheet, Sheetno)

GoExcel.CellValue("A" & 1) = "This is working"

 

GoExcel.Save
GoExcel.Close
newExcelApp = CreateObject("Excel.Application")
newExcelApp.Visible = True
newExcelApp.Workbooks.Open(Loc)


--------------------------------------
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
Message 14 of 23

JorisSteurs1246
Advocate
Advocate

No luck....   strange that the same error occurs on 2 differntr machines

 

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at iLogic.GoExcel.SetCurrentSheet(String fileName, String sheetName)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

0 Likes
Message 15 of 23

MechMachineMan
Advisor
Advisor

Indeed. Do you have multi langauge/cross language settings between your programs? Or is it all in english?


--------------------------------------
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
Message 16 of 23

JorisSteurs1246
Advocate
Advocate

I used to have on both machines Office 2003 ( DUTCH)  and W7  ( ENG )

On one machine I recently uninstalled Office 2003 and replaced it with  Office 2010 ( ENG).

0 Likes
Message 17 of 23

MechMachineMan
Advisor
Advisor
Is your inventor installed on both using dutch?

This is definitely a deeper issue then what the vba is doing.

--------------------------------------
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
Message 18 of 23

JorisSteurs1246
Advocate
Advocate

No only this MS Office I´ve installed is in Dutch because the CD doesn´t give me an other choice.

So Inventor is, and always has been, installed ENG. It might be that MS is installing patches on my PC that fit the Dutch office but whenever I´ve the choice as a user to select a language I choose ENG.

0 Likes
Message 19 of 23

Owner2229
Advisor
Advisor

Is your sheet named "Sheet1" or something else? If it is something else then try to copy it to the rule. Excel most probably named it diferently as you have it in Dutch.

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 20 of 23

JorisSteurs1246
Advocate
Advocate

This ,of course, I made sure that the sheetname matchces the one used in the rule .

 

0 Likes