All you should need to do is add the parameter to your inputs (I added string LinkModName
here) then instead of "*"
put LinkModName
. The "*"
is saying all link modules, but you can replace that with the string name of any specific link module you want to use. Also you should make sure to pass the full path of the Link Module to the function.
Like: /Project_Name/Folder_Name/Link_Module_Name
void WriteAllOutLinksToExcel (string sModuleName, string sBookName, string sSheetName, string LinkModName)
{
OleAutoObj objExcel = oleGetAutoObject("Excel.Application")
OleAutoObj objBook
OleAutoObj objSheet = null
OleAutoArgs oleArgs = create
Object oCur
Module mCur
bool excelVisible
string sTemp = ""
string sResult = ""
string sNum
int iRow = 1
int iCount = 0
int iNum
Link lref
ModName_ targetMod
oleGet(objExcel, "Visible", excelVisible);
if (!excelVisible) olePut(objExcel,"visible",true);
sResult = oleGet(objExcel,"Workbooks", sBookName);
clear oleArgs;
put(oleArgs, sSheetName);
sResult = oleGet(objExcel, "Sheets", oleArgs, objSheet);
mCur = edit(sModuleName,false);
if(mCur != null)
{
View v = view("_ABC");
for oCur in mCur do
{
// Absolute object no..
sTemp = oCur."Absolute Number";
objCell = ExcelGetCell(objSheet, iRow, 1);
olePut(objCell,"Value",sTemp);
// Object text
sTemp = oCur."Object text";
objCell = ExcelGetCell(objSheet, iRow, 2);
olePut(objCell,"Value",sTemp);
// Links
iCount = null;
for lref in oCur -> LinkModName do {
targetMod = target lref;
iNum = targetAbsNo(lref);
sNum = " " iNum " ";
if(iCount == 0)
{
sTemp = fullName(targetMod) sNum;
}
else
{
sTemp = sTemp "\n" fullName(targetMod);
sTemp = sTemp sNum;
}
objCell = ExcelGetCell(objSheet, iRow, 3);
olePut(objCell,"Value",sTemp);
iCount ++;
}
iRow ++;
}
}
close(mCur);
oleCloseAutoObject (objExcel);
}
Hope this helps!