Show Data With Outlook Grid

Show Data With Outlook Grid

You can easily create a calendar grid similar to the one in Outlook to show data. First, start a VB project, then place an MSFlex Grid on the form, with two textboxes to set the start and end dates and a command button to populate the grid. Paste this code in the Form1 code pane:

  Private Sub Command1_Click()     Dim ldBegDate As Date     Dim ldEndDate As Date     Dim lsMonth As String     Dim li, lsStr, lsStartDate, _          lsEndDate, liStartRow, _          liEndRow, liCnt, lsDate, liX     ldBegDate = Format(Text1, _          "mm/dd/yyyy")     ldEndDate = Format(Text2, _          "mm/dd/yyyy")     MSFlexGrid1.Clear: _          MSFlexGrid1.Cols = 5: _          MSFlexGrid1.Rows = 1: _          MSFlexGrid1.RowHeightMin _          = 800     For li = 0 To DateDiff("M", _          ldBegDate, ldEndDate)          lsMonth = Format(DateAdd("m", _               li, ldBegDate), "mmmyyyy")          '== check what month is being           '== processed          lsStartDate = "": lsEndDate = ""          '== Starting Month          If InStr(1, lsMonth, _               Format(ldBegDate, _               "mmmyyyy")) _               Then lsStartDate = ldBegDate          '== Ending Month          If InStr(1, lsMonth, _               Format(ldEndDate, _               "mmmyyyy")) _               Then lsEndDate = ldEndDate          '== Neither Starting or Ending           '== Month          If lsStartDate = "" Then _               lsStartDate = _               Format(DateAdd("m", li, _               ldBegDate), "mm/01/yyyy")          If lsEndDate = "" Then _               lsEndDate = _               Format(DateAdd("m", 1, _               Format(lsStartDate, _               "mm/01/yyyy")) - 1, _               "mm/dd/yyyy")          liStartRow = MSFlexGrid1.Rows          liEndRow = liStartRow + _               DateDiff("d", lsStartDate, _               lsEndDate)          MSFlexGrid1.Rows = _               MSFlexGrid1.Rows + _               liEndRow - liStartRow + 1          MSFlexGrid1.Col = 0          '== Put Dates in grid          For liCnt = 0 To DateDiff("d", _               lsStartDate, lsEndDate)               lsDate = DateAdd("d", liCnt, _                    lsStartDate)               MSFlexGrid1.Row = liStartRow _                    + liCnt               MSFlexGrid1.Text = lsDate               MSFlexGrid1.CellFontSize = _                    10: _                    MSFlexGrid1.CellFontBold _                    = True               MSFlexGrid1.CellAlignment = _                    flexAlignCenterCenter               If WeekDay(lsDate, vbMonday) _                    > 5 Then                    For liX = 1 To _                         MSFlexGrid1.Cols - 1                         MSFlexGrid1.Col = liX                         MSFlexGrid1.CellBackColor = _          &HC0C0C0:   _          MSFlexGrid1.CellForeColor _          = &H80000015                    Next                    MSFlexGrid1.Col = 0               End If          Next     Next '== li..Start to End DateEnd Sub
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes