Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to find the same value in the file name and row A of Excel, read the value in the same column, and create a new file with that value.
I've learned what I've made through the forum, but I'm still a beginner. Please help me learn more. I am attaching my samples.
Dim ExportPath As String = "C:\"
Dim Dialog = New FolderBrowserDialog()
Dialog.SelectedPath = ExportPath
Dialog.ShowNewFolderButton = True
Dialog.Description = "복사할 폴더를 선택해주세요."
If DialogResult.OK = Dialog.ShowDialog() Then
' User clicked 'ok' on dialog box - capture the export path
ExportPath = Dialog.SelectedPath & "\"
End If
Dim Path As String = ExportPath
InvDoc = ThisDoc.Document
Dim refDocs As DocumentsEnumerator = InvDoc.AllReferencedDocuments
Dim refDoc As Document
For Each refDoc In refDocs
MessageBox.Show(refDoc.DisplayName)
Dim NewPN_1 As Object
GoExcel.Open("C:\Users\211215\Desktop\TEST\TEST.xlsx", "sheet1")
Dim oDocNumber As String = ThisDoc.FileName(False)
RowStart =
RowEnd = 100
'Find the first empty cell
For countA = RowStart To (RowEnd * 0.01) + RowStart
'If it's not blank jump to cell + 100. E.g. search cell A2 and then A102 etc.
If Not String.IsNullOrEmpty(GoExcel.CellValue("A" & RowEnd)) Then
'Add another 100 to searched cells
RowEnd = RowEnd + 100
Else
'Else if it's empty exit loop
Exit For
End If
Next
For oRow = RowStart To RowEnd
If (GoExcel.CellValue("A" & oRow)) = oDocNumber Then
GoExcel.CellValue("B" & oRow) = NewPN_1
ThisDoc.Document.SaveAs(Path & NewPN_1 & ".ipt", False)
End If
Next
Next
Dim PN_AssyM As String = GoExcel.CellValue("TEST.xlsx", "sheet1", "C1")
ThisDoc.Document.SaveAs(Path & PN_AssyM & ".iam", False)
iLogicVb.UpdateWhenDone = True
Solved! Go to Solution.