iLogic - stop excel opening while running rule

iLogic - stop excel opening while running rule

Anonymous
Not applicable
539 Views
1 Reply
Message 1 of 2

iLogic - stop excel opening while running rule

Anonymous
Not applicable

I have the following piece of code that works well, but it annoyingly pops open the excel spreadsheet and asks "Want to save changes to 'RPT-E2I-001 - Contracts Overview Report.xlsm'?"

 

How can I stop this from happening? I don't want any of our users seeing/opening/editing the spreadsheet, but I want the rule to read from it discreetly.

 

 
Sub Main ()
question = MessageBox.Show("Do you want to link the case to e2i?" & Chr(10) & "Click <No> if you want enter the case specification manually.", "iLogic Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

'set condition based on answer
    If question = vbYes Then
        'Set excel spreadsheet absolute file path and search for case number match(taken from Part Number iproperty)
        
GoExcel.TitleRow = 3
i = GoExcel.FindRow("F:\Operations\e2i\Reports\RPT-E2I-001 - Contracts Overview Report.xlsm", "Cases", "Case No", "=", iProperties.Value("Project", "Part Number"))
'If case number match is found in e2i
If i <> -1 Then
contract_name = GoExcel.CurrentRowValue("Contract Description")
contract_number = GoExcel.CurrentRowValue("Contract No")
contract_case_qty  = GoExcel.CurrentRowValue("Case QTY")
contract_manager  = GoExcel.CurrentRowValue("PM")
contract_technical_lead = GoExcel.CurrentRowValue("Technical Lead")
contract_case_type = GoExcel.CurrentRowValue("Case Type")
Else
'If case number match is not found in e2i
contract_name = "No matching case in e2i"
contract_number = "No matching case in e2i"
contract_case_qty  = "No matching case in e2i"
contract_manager  = "No matching case in e2i"
contract_technical_lead = "No matching case in e2i"
contract_case_type = "No matching case in e2i"
MessageBox.Show("There is no matching case in e2i", "Title")

End If

    Else If question = vbNo Then
        
    End If
    End Sub

  

 

0 Likes
Accepted solutions (1)
540 Views
1 Reply
Reply (1)
Message 2 of 2

MechMachineMan
Advisor
Advisor
Accepted solution

@c.henderson2HQZG wrote:

I have the following piece of code that works well, but it annoyingly pops open the excel spreadsheet and asks "Want to save changes to 'RPT-E2I-001 - Contracts Overview Report.xlsm'?"

 

How can I stop this from happening? I don't want any of our users seeing/opening/editing the spreadsheet, but I want the rule to read from it discreetly.

 

 
Sub Main ()
question = MessageBox.Show("Do you want to link the case to e2i?" & Chr(10) & "Click <No> if you want enter the case specification manually.", "iLogic Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

'set condition based on answer
    If question = vbYes Then
        'Set excel spreadsheet absolute file path and search for case number match(taken from Part Number iproperty)
        
GoExcel.TitleRow = 3
i = GoExcel.FindRow("F:\Operations\e2i\Reports\RPT-E2I-001 - Contracts Overview Report.xlsm", "Cases", "Case No", "=", iProperties.Value("Project", "Part Number"))
'If case number match is found in e2i
If i <> -1 Then
contract_name = GoExcel.CurrentRowValue("Contract Description")
contract_number = GoExcel.CurrentRowValue("Contract No")
contract_case_qty  = GoExcel.CurrentRowValue("Case QTY")
contract_manager  = GoExcel.CurrentRowValue("PM")
contract_technical_lead = GoExcel.CurrentRowValue("Technical Lead")
contract_case_type = GoExcel.CurrentRowValue("Case Type")
Else
'If case number match is not found in e2i
contract_name = "No matching case in e2i"
contract_number = "No matching case in e2i"
contract_case_qty  = "No matching case in e2i"
contract_manager  = "No matching case in e2i"
contract_technical_lead = "No matching case in e2i"
contract_case_type = "No matching case in e2i"
MessageBox.Show("There is no matching case in e2i", "Title")

End If

    Else If question = vbNo Then
        
    End If

GoExcel.Save
GoExcel.Close
End Sub   

 


 


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