- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this ilogic rule:
It works perfectly, the only issue I have is that the ARTICOLI.xlsm Excel file from which the macro starts remains open in the background.
How can I make sure it closes?
Thank you"
' IMPORTA IL LAYOUT DI DISTINTA Dim doc As AssemblyDocument = ThisDoc.Document Dim oBom As BOM = doc.ComponentDefinition.BOM oBom.ImportBOMCustomization("K:\18_UFFICIOTECNICO\CON_INV\Templates\struttura distinta_SONAR_ARTICOLI.xml") ' Percorso del layout della distinta da attivare per SONAR ARTICOLI ' VERIFICA IL NOME DEL COMPONENTE PRINCIPALE Dim nameVRpart As String = iProperties.Value("Project", "Part Number") If nameVRpart.Contains(" ") Then Dim modnomeprt As DialogResult = MessageBox.Show("Il nome della parte di assieme contiene spazi, aggiornare il numero parte? Attenzione, l'assieme deve essere estratto!!!!!", "Attenzione", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) If modnomeprt = DialogResult.Yes Then Dim myparam As String = InputBox("Inserire il numero parte", "Numero parte", "Inserisci il nome della parte") iProperties.Value("Project", "Part Number") = myparam End If End If ' CREA PARTE VIRTUALE iLogicVb.RunExternalRule("K:\18_UFFICIOTECNICO\CON_INV\Templates\Regole utili Lampocar\crea parte vituale.txt") 'iLogicVb.RunExternalRule("K:\18_UFFICIOTECNICO\CON_INV\Templates\Regole utili Lampocar\assegna item 0 e posiziona in testa.txt") iLogicVb.RunExternalRule("K:\18_UFFICIOTECNICO\CON_INV\Templates\Regole utili Lampocar\sincronizza ipropreties parte virtuale.txt") Dim DOVE As String = "K:\18_UFFICIOTECNICO\CON_INV\ESPORTAZIONE\" Dim NOME As String = ThisDoc.FileName(False) ' Senza estensione Dim DATA As String = DateString Dim fileName2 As String = DOVE & NOME & "_ARTICOLI_" & DATA & ".xlsx" ThisBOM.Export("Strutturata", fileName2, kMicrosoftExcelFormat) GoExcel.Open(fileName2, "Sheet1") i = GoExcel.FindRow(fileName2, "Sheet1", "Numero parte", "=", iProperties.Value("Project", "Part Number")) cellmass = "G" & i mass = Round(iProperties.Mass, 3) GoExcel.CellValue(cellmass) = mass GoExcel.CellValue("D" & i) = Parameter("GRUPPO") GoExcel.CellValue("E" & i) = Parameter("TIPO") GoExcel.CellValue("F" & i) = Parameter("CATEGORIA") GoExcel.CellValue("C" & i) = "PZ" 'iProperties.Mass = GoExcel.CellValue(cellmass) excelApp = GoExcel.Application excelApp.Run("'" & "K:\18_UFFICIOTECNICO\CON_INV\Regole esterne per anagrafica\MACRO ESPORTAZIONE\ARTICOLI.xlsm" & "'!SetArt") excelApp = Nothing GoExcel.Save GoExcel.Close ' Elimina parte virtuale iLogicVb.RunExternalRule("K:\18_UFFICIOTECNICO\CON_INV\Templates\Regole utili Lampocar\eliminazione parte virtuale.txt") 'RIPRISTINA VISTA PRINCIPALE oBom.ImportBOMCustomization("K:\18_UFFICIOTECNICO\CON_INV\Templates\STRUTTRA_COMPILAZIONE_LAMPOCAR.xml") ' Percorso del layout della distinta da attivare di default 'PERCORSO DA APRIRE oPath = DOVE Dim Proc As String = "Explorer.exe" Dim Args As String = ControlChars.Quote & oPath & ControlChars.Quote Process.Start(Proc, Args)
Solved! Go to Solution.