Hi, you have to think witch trigger to use for it (new document, before save etc.), but I think that you can use one of these rules below (you have to modify it for your needs ofc.).
If you already have the iProperties in place than you can use this:
GoExcel.Open("C:\myfolder\myexceltable.xlsx", "Sheet1")
iProperties.Value("Custom", "Text 1") = GoExcel.CellValue("B2")
iProperties.Value("Custom", "Text 2") = GoExcel.CellValue("B3")
...
GoExcel.Close
If you want the iProperty names to be taken from the excel table than you can use this one:
GoExcel.Open("C:\myfolder\myexceltable.xlsx", "Sheet1")
Dim oName As String = GoExcel.CellValue("A2")
iProperties.Value("Custom", oName) = GoExcel.CellValue("B2")
oName = GoExcel.CellValue("A3")
iProperties.Value("Custom", oName) = GoExcel.CellValue("B3")
...
GoExcel.Close
Or if you have a lot of text cells than you can use this one to automate the procces. It will find all filled cells in all rows up to infinity.
GoExcel.Open("C:\myfolder\myexceltable.xlsx", "Sheet1")
RowStart = 2
RowEnd = 100
For countA = RowStart To (RowEnd * 0.01) + RowStart
If Not String.IsNullOrEmpty(GoExcel.CellValue("A" & RowEnd)) Then
RowEnd = RowEnd + 100
Else
Exit For
End If
Next
For rowPN = RowStart To RowEnd
If String.IsNullOrEmpty(GoExcel.CellValue("A" & RowPN)) Then
rowN = rowPN - 1
Exit For
End If
Next
For oRow = RowStart To RowN
Dim oName As String = GoExcel.CellValue("A" & oRow)
iProperties.Value("Custom", oName) = GoExcel.CellValue("B" & oRow)
Next
GoExcel.Close
Just remember, that the last rule will stop on first empty row it will find.
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