Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm creating a BOM Excel export and i want to copy two colums (the articlecode and quantity) from this file to a different Excel file.
I copy the range of cells i need, but when i paste the cells into the other Excel document, it basically skips the empty cells and compacts the values, so the variables in the in wrong rows e.g;
BOM export
Current Result in other Excel
Desired result in other Excel
The code i use:
Imports System.IO
Dim oDoc As Inventor.Document = ThisDoc.Document
Dim oFullAssemblyPath = oDoc.FullDocumentName
Dim oFolderPath As String = Left(oFullAssemblyPath, (InStrRev(oFullAssemblyPath, "\", - 1, vbTextCompare) - 1)) & "\"
Dim oTempBomFileName As String = oFolderPath & "File1"
Dim oVaultExcel As String = oFolderPath & "File2"
Dim oVaultExcelSheet As String = "Sheet"
ThisBOM.Export("Structured", oTempBomFileName, kMicrosoftExcelFormat,oSheet)
Dim oArticles = GoExcel.CellValues(oTempBomFileName, "Sheet1", "J2", "J21")
Dim oQuantities = GoExcel.CellValues(oTempBomFileName, "Sheet1", "F2", "F21")
GoExcel.Open(oVaultExcel, oVaultExcelSheet)
GoExcel.CellValues(oVaultExcel, oVaultExcelSheet, "E34", "E53") = oArticles
GoExcel.CellValues(oVaultExcel, oVaultExcelSheet, "F34", "F53") = oQuantities
GoExcel.Save
GoExcel.Close
Solved! Go to Solution.