PHP Reload Page After 10 Seconds

Here is my take on the question, how to refresh the page after 10 seconds

Enjoy

Coffee Cup

<script type="text/javascript">

  var timeout = setTimeout("location.reload(true);",10000);
  function resetTimeout() {
    clearTimeout(timeout);
    timeout = setTimeout("location.reload(true);",10000);
  }
  
</script>  

PHP Code for FB Plugin

Here is the code I used in integrating the fb plugin using iframe into the website.

Please replace the fields that require your actual account.

I also included an html tag .

Enjoy,

Coffee Cup

https://developers.facebook.com/docs/plugins/like-button


JavaScript SDK


Step 1: Include the JavaScript SDK on your page once, ideally right after the opening body tag.
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v14.0" nonce="F1YcA0n6"></script>
Step 2: Place this code wherever you want the plugin to appear on your page.
<div class="fb-like" data-href="https://www.facebook.com/PoshMotorcycleShop" data-width="200" data-layout="standard" data-action="like" data-size="small" data-share="true"></div>


IFrame

<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FPoshMotorcycleShop&width=200&layout=standard&action=like&size=small&share=true&height=35&appId" width="200" height="35" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>




For Android the URL schema is:

fb://page/page_id
For iOS the URL schema is:

fb://page?id=page_id






https://developers.facebook.com/docs/plugins/like-button

<html>
<head>
  <title>Your Website Title</title>
    <!-- You can use open graph tags to customize link previews.
    Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
  <meta property="og:url"           content="https://www.your-domain.com/your-page.html" />
  <meta property="og:type"          content="website" />
  <meta property="og:title"         content="Your Website Title" />
  <meta property="og:description"   content="Your description" />
  <meta property="og:image"         content="https://www.your-domain.com/path/image.jpg" />
</head>
<body>

  <!-- Load Facebook SDK for JavaScript -->
  <div id="fb-root"></div>
  <script async defer crossorigin="anonymous" 
        src="https://connect.facebook.net/en_US/sdk.js#xfbml=1
             &version={graph-api-version}
             &appId={your-facebook-app-id}
             &autoLogAppEvents=1" 
        nonce="FOKrbAYI">
  </script>

  <!-- Your like button code -->
  <div class="fb-like" 
       data-href="https://www.your-domain.com/your-page.html" 
       data-width=""
       data-layout="standard" 
       data-action="like" 
       data-size="small"  
       data-share="true">
  </div>

</body>
</html>

PHP Date Format

A common mistake that i always do is to forget the strtotime field

Here is where i usually use it.

Enjoy

Coffee Cup


***************************************************

	//20221117
	if ($pldate != '')
	{
		$pldate = date("m/d/Y", strtotime($pldate));
	}
	
	if ($plcheck_date != '')
	{
		$plcheck_date = date("m/d/Y", strtotime($plcheck_date));	
	}
				
?>	
        <div id="page-wrapper">

***************************************************

$pltype = $_POST['pltype'];
$pltype = htmlspecialchars( $pltype, ENT_QUOTES);

	//20160904
	if ($pldate != '')
	{
		$pldate = date("Y-m-d", strtotime($pldate));
	}
	
	if ($plcheck_date != '')
	{
		$plcheck_date = date("Y-m-d", strtotime($plcheck_date));	
		$plcheck_date2 = date("Y-m-d", strtotime($plcheck_date));	
	}
	else
	{
		$plcheck_date2 = NULL;	
	}

***************************************************


Delphi Get Sales Summary by Month (January to December)

Another feature i hope there was shortcut to, but it seems i need to write it myself.

Just wanted to share it here

Coffee Cup


    VFROM = VYEAR || '-1-1';
    VTO = VYEAR || '-1-31';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT1 = 0;
    ELSE PAMT1 = VAMT;  

    /* /////////////////////////////// */



    /* IF FEB LESS THAN MARCH 1 - THERE IS FEB 28 AND FEB 29 */
    VFROM = VYEAR || '-2-1';
    VTO = VYEAR || '-3-1';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO < :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT2 = 0;
    ELSE PAMT2 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-3-1';
    VTO = VYEAR || '-3-31';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT3 = 0;
    ELSE PAMT3 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-4-1';
    VTO = VYEAR || '-4-30';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT4 = 0;
    ELSE PAMT4 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-5-1';
    VTO = VYEAR || '-5-31';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT5 = 0;
    ELSE PAMT5 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-6-1';
    VTO = VYEAR || '-6-30';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT6 = 0;
    ELSE PAMT6 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-7-1';
    VTO = VYEAR || '-7-31';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT7 = 0;
    ELSE PAMT7 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-8-1';
    VTO = VYEAR || '-8-31';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT8 = 0;
    ELSE PAMT8 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-9-1';
    VTO = VYEAR || '-9-30';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT9 = 0;
    ELSE PAMT9 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-10-1';
    VTO = VYEAR || '-10-31';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT10 = 0;
    ELSE PAMT10 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-11-1';
    VTO = VYEAR || '-11-30';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT11 = 0;
    ELSE PAMT11 = VAMT;  

    /* /////////////////////////////// */



    VFROM = VYEAR || '-12-1';
    VTO = VYEAR || '-12-31';

    SELECT SUM(Z.PAMT)
    FROM  PAYSLIP Z
    WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
    INTO :VAMT;  

    IF (VAMT IS NULL) THEN
         PAMT12 = 0;
    ELSE PAMT12 = VAMT;  

    /* /////////////////////////////// */

Delphi Code to get the Next 6 months

This code is what i use to get the 6 months of the month. Including the parameter of February where we sometimes have a 28th or 29th day.

Just in case this code helps you, please drop us a line

Coffee Cup




   /* 2-16-2023 - CREATE SUMMARY */

  VYEAR = EXTRACT(YEAR FROM VDATEFROM);
  VMONTH = EXTRACT(MONTH FROM VDATEFROM);

  SAFROM1 = VYEAR || '-' || VMONTH || '-1';
  IF (VMONTH = 12) THEN
  BEGIN
    VMONTH = 1;
    VYEAR =  VYEAR + 1;
    SATO1 = VYEAR || '-' || VMONTH || '-1';
  END
  ELSE 
  BEGIN 
    VMONTH = VMONTH + 1;
    SATO1 = VYEAR || '-' || VMONTH || '-1';
  END
  SATO1 = SATO1 - 1;
  SAMONTH1 = 0;


  VDATE = SATO1 + 1;
  VYEAR = EXTRACT(YEAR FROM VDATE);
  VMONTH = EXTRACT(MONTH FROM VDATE);

  SAFROM2 = VYEAR || '-' || VMONTH || '-1';
  IF (VMONTH = 12) THEN
  BEGIN
    VMONTH = 1;
    VYEAR =  VYEAR + 1;
    SATO2 = VYEAR || '-' || VMONTH || '-1';
  END
  ELSE 
  BEGIN 
    VMONTH = VMONTH + 1;
    SATO2 = VYEAR || '-' || VMONTH || '-1';
  END
  SATO2 = SATO2 - 1;
  SAMONTH2 = 0;



  VDATE = SATO2 + 1;
  VYEAR = EXTRACT(YEAR FROM VDATE);
  VMONTH = EXTRACT(MONTH FROM VDATE);

  SAFROM3 = VYEAR || '-' || VMONTH || '-1';
  IF (VMONTH = 12) THEN
  BEGIN
    VMONTH = 1;
    VYEAR =  VYEAR + 1;
    SATO3 = VYEAR || '-' || VMONTH || '-1';
  END
  ELSE 
  BEGIN 
    VMONTH = VMONTH + 1;
    SATO3 = VYEAR || '-' || VMONTH || '-1';
  END
  SATO3 = SATO3 - 1;
  SAMONTH3 = 0;



  VDATE = SATO3 + 1;
  VYEAR = EXTRACT(YEAR FROM VDATE);
  VMONTH = EXTRACT(MONTH FROM VDATE);

  SAFROM4 = VYEAR || '-' || VMONTH || '-1';
  IF (VMONTH = 12) THEN
  BEGIN
    VMONTH = 1;
    VYEAR =  VYEAR + 1;
    SATO4 = VYEAR || '-' || VMONTH || '-1';
  END
  ELSE 
  BEGIN 
    VMONTH = VMONTH + 1;
    SATO4 = VYEAR || '-' || VMONTH || '-1';
  END
  SATO4 = SATO4 - 1;
  SAMONTH4 = 0;




  VDATE = SATO4 + 1;
  VYEAR = EXTRACT(YEAR FROM VDATE);
  VMONTH = EXTRACT(MONTH FROM VDATE);

  SAFROM5 = VYEAR || '-' || VMONTH || '-1';
  IF (VMONTH = 12) THEN
  BEGIN
    VMONTH = 1;
    VYEAR =  VYEAR + 1;
    SATO5 = VYEAR || '-' || VMONTH || '-1';
  END
  ELSE 
  BEGIN 
    VMONTH = VMONTH + 1;
    SATO5 = VYEAR || '-' || VMONTH || '-1';
  END
  SATO5 = SATO5 - 1;
  SAMONTH5 = 0;



  VDATE = SATO5 + 1;
  VYEAR = EXTRACT(YEAR FROM VDATE);
  VMONTH = EXTRACT(MONTH FROM VDATE);

  SAFROM6 = VYEAR || '-' || VMONTH || '-1';
  IF (VMONTH = 12) THEN
  BEGIN
    VMONTH = 1;
    VYEAR =  VYEAR + 1;
    SATO6 = VYEAR || '-' || VMONTH || '-1';
  END
  ELSE 
  BEGIN 
    VMONTH = VMONTH + 1;
    SATO6 = VYEAR || '-' || VMONTH || '-1';
  END
  SATO6 = SATO6 - 1;
  SAMONTH6 = 0;

  SAOTHERS = 0;
  SAUNPAID = 0;

  SUSPEND;

   /* 2-16-2023 - CREATE SUMMARY */
















    /* 2-16-2023 - CREATE SUMMARY */
    VDATE = NULL;
    IF (OCCHECK_DATE IS NOT NULL) THEN
    BEGIN
      VDATE = OCCHECK_DATE;
    END
    IF (OMDATE IS NOT NULL) THEN
    BEGIN
      VDATE = OMDATE;
    END

    IF (VDATE IS NOT NULL) THEN
    BEGIN
      IF ((VDATE >= SAFROM1) AND (VDATE <= SATO1)) THEN
        SAMONTH1 = SAMONTH1 + CP_INVAMT;
      ELSE
      IF ((VDATE >= SAFROM2) AND (VDATE <= SATO2)) THEN
        SAMONTH2 = SAMONTH2 + CP_INVAMT;
      ELSE
      IF ((VDATE >= SAFROM3) AND (VDATE <= SATO3)) THEN
        SAMONTH3 = SAMONTH3 + CP_INVAMT;
      ELSE
      IF ((VDATE >= SAFROM4) AND (VDATE <= SATO4)) THEN
        SAMONTH4 = SAMONTH4 + CP_INVAMT;
      ELSE
      IF ((VDATE >= SAFROM5) AND (VDATE <= SATO5)) THEN
        SAMONTH5 = SAMONTH5 + CP_INVAMT;
      ELSE
      IF ((VDATE >= SAFROM6) AND (VDATE <= SATO6)) THEN
        SAMONTH6 = SAMONTH6 + CP_INVAMT;
      ELSE
        SAOTHERS = SAOTHERS + CP_INVAMT;
    END

Delphi + Excel OLE Manipulation (Change Font, Masking and More)

Delphi + Excel OLE

Thought of saving this one here. For those who still use delphi in 2023, here are the features you can access. Just in case you have questions or issues encountered, just drop me a line

Coffee Cup

...control Excel with OLE?
Autor: Thomas Stutz
[ Print tip ]	 	 

Tip Rating (503):	 
     

uses
  ComObj;

var
  ExcelApp: OleVariant;

implementation


procedure TForm1.Button1Click(Sender: TObject);
const
  // SheetType
  xlChart = -4109;
  xlWorksheet = -4167;
  // WBATemplate
  xlWBATWorksheet = -4167;
  xlWBATChart = -4109;
  // Page Setup
  xlPortrait = 1;
  xlLandscape = 2;
  xlPaperA4 = 9;
  // Format Cells
  xlBottom = -4107;
  xlLeft = -4131;
  xlRight = -4152;
  xlTop = -4160;
  // Text Alignment
  xlHAlignCenter = -4108;
  xlVAlignCenter = -4108;
  // Cell Borders
  xlThick = 4;
  xlThin = 2;
var
  ColumnRange: OleVariant;

  // Function to get the number of Rows in a Certain column

  function GetLastLine(AColumn: Integer): Integer;
  const
    xlUp = 3;
  begin
    Result := ExcelApp.Range[Char(96 + AColumn) + IntToStr(65536)].end[xlUp].Rows.Row;
  end;

begin
  { Start Excel }

  // By using GetActiveOleObject, you use an instance of Word that's already running,
  // if there is one.
  try
    ExcelApp := GetActiveOleObject('Excel.Application');
  except
    try
      // If no instance of Word is running, try to Create a new Excel Object
      ExcelApp := CreateOleObject('Excel.Application');
    except
      ShowMessage('Cannot start Excel/Excel not installed ?');
      Exit;
    end;
  end;

  // Add a new Workbook, Neue Arbeitsmappe ?ffnen
  ExcelApp.Workbooks.Add(xlWBatWorkSheet);

  // Open a Workbook, Arbeitsmappe ?ffnen
  ExcelApp.Workbooks.Open('c:\YourFileName.xls');


  // Rename the active Sheet
  ExcelApp.ActiveSheet.Name := 'This is Sheet 1';

  // Rename
  ExcelApp.Workbooks[1].WorkSheets[1].Name := 'This is Sheet 1';

  // Insert some Text in some Cells[Row,Col]
  ExcelApp.Cells[1, 1].Value := 'SwissDelphiCenter.ch';
  ExcelApp.Cells[2, 1].Value := 'http://www.swissdelphicenter.ch';
  ExcelApp.Cells[3, 1].Value := FormatDateTime('dd-mmm-yyyy', Now);

  // Setting a row of data with one call
  ExcelApp.Range['A2', 'D2'].Value := VarArrayOf([1, 10, 100, 1000]);

  // Setting a formula
  ExcelApp.Range['A11', 'A11'].Formula := '=Sum(A1:A10)';

  // Change Cell Alignement
  ExcelApp.Cells[2, 1].HorizontalAlignment := xlright;

  // Change the Column Width.
  ColumnRange := ExcelApp.Workbooks[1].WorkSheets[1].Columns;
  ColumnRange.Columns[1].ColumnWidth := 20;
  ColumnRange.Columns[2].ColumnWidth := 40;

  // Change Rowheight / Zeilenh?he ?ndern:
  ExcelApp.Rows[1].RowHeight := 15.75;

  // Merge cells, Zellen verbinden:
  ExcelApp.Range['B3:D3'].Mergecells := True;

  // Apply borders to cells, Zellen umrahmen:
  ExcelApp.Range['A14:M14'].Borders.Weight := xlThick; // Think line/ Dicke Linie
  ExcelApp.Range['A14:M14'].Borders.Weight := xlThin;  // Thin line D邦nne Linie

  // Set Bold Font in cells, Fettdruck in den Zellen

  ExcelApp.Range['B16:M26'].Font.Bold := True;

  // Set Font Size, Schriftgr??e setzen
  ExcelApp.Range['B16:M26'].Font.Size := 12;

  //right-aligned Text, rechtsb邦ndige Textausrichtung
  ExcelApp.Cells[9, 6].HorizontalAlignment := xlright;

  // horizontal-aligned text, horizontale Zentrierung
  ExcelApp.Range['B14:M26'].HorizontalAlignment := xlHAlignCenter;

  // left-aligned Text, vertikale Zentrierung
  ExcelApp.Range['B14:M26'].VerticallyAlignment := xlVAlignCenter;


  { Page Setup }

  ExcelApp.ActiveSheet.PageSetup.Orientation := xlLandscape;

  // Left, Right Margin (Seitenr?nder)
  ExcelApp.ActiveSheet.PageSetup.LeftMargin  := 35;
  ExcelApp.ActiveSheet.PageSetup.RightMargin := -15;

  // Set Footer Margin
  ExcelApp.ActiveSheet.PageSetup.FooterMargin := ExcelApp.InchesToPoints(0);

  // Fit to X page(s) wide by Y tall
  ExcelApp.ActiveSheet.PageSetup.FitToPagesWide := 1;  // Y
  ExcelApp.ActiveSheet.PageSetup.FitToPagesTall := 3; // Y

  // Zoom
  ExcelApp.ActiveSheet.PageSetup.Zoom := 95;

  // Set Paper Size:
  ExcelApp.PageSetup.PaperSize := xlPaperA4;

  // Show/Hide Gridlines:
  ExcelApp.ActiveWindow.DisplayGridlines := False;

  // Set Black & White
  ExcelApp.ActiveSheet.PageSetup.BlackAndWhite := False;

  // footers
  ExcelApp.ActiveSheet.PageSetup.RightFooter := 'Right Footer / Rechte Fu?zeile';
  ExcelApp.ActiveSheet.PageSetup.LeftFooter  := 'Left Footer / Linke Fu?zeile';

  // Show Excel Version:
  ShowMessage(Format('Excel Version %s: ', [ExcelApp.Version]));

  // Show Excel:
  ExcelApp.Visible := True;

  // Save the Workbook
  ExcelApp.SaveAs('c:\filename.xls');

  // Save the active Workbook:
  ExcelApp.ActiveWorkBook.SaveAs('c:\filename.xls');

end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  // Quit Excel
  if not VarIsEmpty(ExcelApp) then
  begin
    ExcelApp.DisplayAlerts := False;  // Discard unsaved files....
    ExcelApp.Quit;
  end;
end;

Bootstrap Website showing Date Picker using PHP

Configurable-Date-Picker-Plugin-For-Bootstrap

Using angular, a few of the requests were to make the date into a date picker. I have found the code and wanted to share it here

Enjoy,

Coffee Cup

<script   src="https://code.jquery.com/jquery-2.2.3.min.js"   integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo="   crossorigin="anonymous"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/js/bootstrap-datepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.1/css/bootstrap-datepicker3.min.css">

<script>
$( document ).ready(function() {
    $("#from-datepicker").datepicker({ 
        format: 'yyyy-mm-dd'
    });
    $("#from-datepicker").on("change", function () {
        var fromdate = $(this).val();
        alert(fromdate);
    });
}); 
</script>

	<div class="form-group">
		<label>Date</label>
		<input type="text" id="from-datepicker"/>
	</div>

“Interface not supported” error when attempting to open Excel or Word from Delphi

Interface not supported

When using Delphi that outputs some text into Excel or Word, I encountered the error “Interface not supported” on one machine

The problem was that the previous version of Excel was uninstalled incorrectly on the machine. To fix it, I used these steps :

  1. Open the regedit editor.
  2. Open HKEY_CLASSES_ROOT >> TypeLib >> {00020813-0000-0000-C000-000000000046}

(The Excel PIA key is {00020813-0000-0000-C000-000000000046}) 

3. Delete the version that you don’t have. Leave only the version that you have instaled. In my case it was Excel 2010 which is 1.7. For Excel 2013 is 1.8, and for Excel 2016 is 1.9

Here are the version controls

Excel HKEY_CLASSES_ROOT\TypeLib{00020813-0000-0000-C000-000000000046}\

  • 1.7 is for Office 2010
  • 1.8 is for Office 2013
  • 1.9 is for Office 2016

Word HKEY_CLASSES_ROOT\TypeLib{00020905-0000-0000-C000-000000000046}\

  • 8.5 is for Office 2010
  • 8.6 is for Office 2013
  • 8.7 is for Office 2016

PowerPoint HKEY_CLASSES_ROOT\TypeLib{91493440-5A91-11CF-8700-00AA0060263B}\

  • 2.a is for Office 2010
  • 2.b is for Office 2013
  • 2.c is for Office 2016

Outlook HKEY_CLASSES_ROOT\TypeLib{00062FFF-0000-0000-C000-000000000046}\

  • 9.4 is for Office 2010
  • 9.5 is for Office 2013
  • 9.6 is for Office 2016

Hope it helps

Coffee Cup