0

I am developing an excel add-in. I have serial numbers(ex. 100 psc) and I want to check when excel add-in installing on pc. But I cant do it with VS2010 setup project because it is not supporting serial number list storing and checking.

so I want to do this with setup factory and I did it like this link: link

but I have a problem excel ; enter image description here

if I select "Yes", excel working for opening .dll, if select "No", it do anything.

enter image description here

and my setup factory list like this. enter image description here

and my setup factory "on post install script", my Addinfilename value is "Posta Guvercini Excel AddIn For 2010.dll"

    -- Determine registry key (2 = HK CURRENT USER)
sVersions = Registry.GetKeyNames(2, "Software\\Microsoft\\Office");

-- Iterate through the registry keys per MS Office-version
--Next line has SetupFactory 8 code
--for iCount1, sVersion in sVersions do    
for iCount1, sVersion in pairs(sVersions) do    

    -- Try opening the registry key
    sSubKey = "Software\\Microsoft\\Office\\"..sVersion..
              "\\Excel\\Options\\"
    sValues = Registry.GetValueNames(2, sSubKey);

    --initialize index counter
    iIndex = -2
    if sValues then

        --Determine the index of the maximimum OPEN registry entry
        --Next line has SetupFactory 8 code
        --for iCount2, sValue in sValues do
        for iCount2, sValue in pairs(sValues) do

            if (String.Left(sValue, 4) == "OPEN") then            
                --Check whether the user did not already install
                --the same add-in to prevent errors when opening Excel
                sKeysValue = Registry.GetValue(2, sSubKey, sValue, true)  
                if String.Find(sKeysValue, SessionVar.Expand(
                              "%AddinFileName%"), 1, false) > 0 then
                    iIndex = -1
                    -- leave loop
                    break;
                else
                    if (sValue == "OPEN") then
                        iIndex = 0
                    else
                        iIndex = String.ToNumber(String.Mid(
                                 sValue, 5, String.Length(sValue)-4))
                    end;
                end;
            end;
        end;

        -- -1 means: This add-in is already installed; we're done
        if iIndex ~= -1 then        
            --Determine path based on variable "%AddinFileName%
            sAppPath = String.Char(34)..
                       SessionVar.Expand("%AppFolder%")..
                       "\\"..
                       SessionVar.Expand("%AddinFileName%")..
                       String.Char(34)

            -- -2 is the initialized value of the index counter
            if (iIndex == -2) then
                -- OPEN-key does not exist
                Registry.SetValue(2, sSubKey, "OPEN",
                                  sAppPath, REG_SZ)
            else
                Registry.SetValue(2, sSubKey, "OPEN"..(iIndex + 1),
                                  sAppPath, REG_SZ)
            end;
        end;
    end;
end;
Savas Adar
  • 4,083
  • 3
  • 46
  • 54

2 Answers2

0

Looks like you are building an Automation addin.
If so you need to prefix the addin name with /A to tell Excel that its an automation addin. otherwise its expecting an XLL or an XLA or an XLAM

Charles Williams
  • 23,121
  • 5
  • 38
  • 38
0

i solve this problem. When doing excel installiation, we must use registry record.

result = Registry.SetValue( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Office\\Excel\\Addins\\company" , "LoadBehavior" , "3" , REG_DWORD );
result = Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Office\\Excel\\Addins\\company" ,"FriendlyName", "program name", REG_SZ);
result = Registry.SetValue( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Office\\Excel\\Addins\\company" , "Description" , "program name" , REG_SZ );
result = Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Office\\Excel\\Addins\\company" ,"Manifest", SessionVar.Expand("%AppFolder%\\myvtofile.vsto|vstolocal"), REG_SZ);

for add-in start when excel startup.

LoadBehavior key's value should be "3".

Savas Adar
  • 4,083
  • 3
  • 46
  • 54