In this article, we will show you the way to add a “Tip of the Day” feature in Word to learn new Word skills every day.
Since Word is so closely related to our working, it would be such a great help to learn some tips of it as to improve efficiency. Therefore, we want to show you the method to add a “Tip of the Day” feature in your Word, so you can learn some new stuff every time you start Word.
To do so, we suggest you to find some Word tips you might be interested and put them in an Excel file. Here is detailed explanation:
Create an Excel File
- First of all, start Excel.
- Rename the first sheet as “Tips”.
- Next, enter “Number”, “Tip” and “Times” into the first cell of first three columns.
- Then in “Number” column, enter numbers to number tips.
- In the “Tip” column, input each tip in one cell.
- And in the “Times” column, click to select the entire column and right click and choose “Format Cells”.
- In the “Format Cells” box open, select “Number” under “Number” tab.
- Choose “0” for the “Decimal places” and click “OK”.
- Noe in the “Times” column, type “0” (zero).
- Lastly, name the file as “Tip of the Day” and keep it in “C:\Users\Public\Documents\Sample”. This path is optional. You can store the file at any location you like. But we suggest you naming the file and sheet as same as we do.
You can click here to download a sample file.
Insert a Module in VBA Project
- To begin with, press “Alt+ F11” to trigger VBA editor.
- Secondly, click “Normal” project.
- Thirdly, click “Insert” and choose “Module”.
- Next open new module by double clicking on it.
- Paste the following codes there:
Sub AutoExec() Dim nCellIndex As Integer Dim nMinCellValue As Integer Dim nMinCellIndex As Integer Dim objExcel As Excel.Application Dim objWorkbook As Excel.Workbook Dim objWorksheet As Excel.Worksheet Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("C:\Users\Public\Documents\Sample\Tip of the Day.xlsx") Set objWorksheet = objWorkbook.Sheets("Tips") ' Initialization nMinCellValue = 0 nMinCellIndex = -1 For nCellIndex = 2 To objWorksheet.UsedRange.Rows.Count If (nMinCellIndex = -1) Then nMinCellValue = objWorksheet.Cells(nCellIndex, 3).Value nMinCellIndex = nCellIndex Else If (objWorksheet.Cells(nCellIndex, 3).Value < nMinCellValue) Then nMinCellValue = objWorksheet.Cells(nCellIndex, 3).Value nMinCellIndex = nCellIndex End If End If Next nCellIndex frmTipOfTheDay.txtTipOfTheDay.Text = objWorksheet.Cells(nMinCellIndex, 2).Value frmTipOfTheDay.Show Modal objWorksheet.Cells(nMinCellIndex, 3).Value = objWorksheet.Cells(nMinCellIndex, 3).Value + 1 objWorkbook.Close SaveChanges:=True ' Close Excel application using the Quit method. objExcel.Application.Quit ' Release the object variable. Set objExcel = Nothing End Sub
Note:
In code line:
Set objWorkbook = objExcel.Workbooks.Open("C:\Users\Public\Documents\Sample\Tip of the Day.xlsx")
The string represents the full name of the Excel file we created just now. Modify it accordingly.
- Finally, click “Save” to save codes.
Insert a User Form
Still, in VBA editor, you need to insert a user form to show the tip. This is what you need to create:
- Similarly, click “Insert”.
- Only this time, you choose “UserForm”.
- Next press “F4” to open the “Properties Window” at the left down-corner.
- Name the form as “frmTipOfTheDay”.
- Choose a background color for the form.
- And enter “Tip of the Day” for “Caption”.
- Set “ShowModal” as “False”.
- Next click “View” tab and choose “Toolbox”.
- On tool box, click “Label”.
- Draw a label on the form.
- And click on the label. Type “Tip of the Day” for its caption. And set the background style as transparent. Besides, set font size and color.
- Now click “TextBox” on tool box. Draw a text box on the form.
- Click on text box and set the text box properties properly. Name it as “txtTipOfTheDay”. And choose “True” for “MultiLine”. In addition, choose font type and size. Choose a vertical scroll bar for the text box.
- Next choose “CommandButton” from tool box.
- Click on the button and name it as “btnClose”. Set the caption as “Close”.
- And double click “Close” button and enter a codes, such as below:
- And save codes.
Next go to assign a button for macro “AutoExec”. For detailed steps, please refer to this article: How to Remove the Formatting of Pasted Texts with Macro and VBA in Your Word
Here is the final effect:
Back up Now
No one wants to experience data corruption. But the truth is it’s very likely to happen, with no warning. Under such circumstances, it’s time for your backup to do its job. However, you must have at least one backup dating back to a certain time point. Without one, you will have to find a tool to repair docx.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt xlsx and pdf repair software products. For more information visit www.datanumen.com