How to Easily Convert between Various Temperature Units, such as Celsius, Fahrenheit, Kelvin, in Your Word

In this article, we will show you how to easily convert between temperature units, such as Celsius, Fahrenheit, Kelvin, in your Word.

Make good use of Word VBA, you can create a lot small but useful tools. For instance, you are absolutely fine to create a temperature converter in Word to do the tedious conversion for you. Therefore, read on to follow more details. Convert between Various Temperature Units

Insert a User Form

To create the converter, you will have to create a user form first.

  1. First of all, press “Alt+ F11” to open VBA editor.
  2. Next click “Normal” on the left column.
  3. Then click “Insert” and select “UserForm”.Click "Normal"->Click "Insert"->Click "UserForm"
  4. Click on the handles around form to adjust its size.
  5. Next press “F4” to trigger the “Properties Window”.
  6. In the window, name the user form as “frmTemperatureConverter” and set its caption as “Temperature Converter”.
  7. In addition, set the “ShowModal” property of the form as “False”.
  8. Then on the menu bar, click “Toolbox” to bring it out.
  9. Use controls on the toolbox to create a label, two text boxes, two command buttons, and two combo boxes. Put these controls on the form in following order:Create Two Text Boxes, Two Command Buttons, Two Combo Boxes and One Label
  10. Next set specific properties for controls created:
  • First click on text box 1. Name it as “txtTempValue1”.
  • Then click on text box 2 and name it as “txtTempValue2”.
  • Next click on the label and set its caption as “=”.
  • Click on combo box 1 and name it as “cmbTempUnit1”.
  • And click on combo box 2 and name it as “cmbTempUnit2”.
  • Next click on command button 1 and name it as “btnConvert”. Set caption as “Convert”.
  • Click on command button 2 and name it as “btnClose”. Set its caption as “Close”.

Besides, set other properties if necessary.

Input Codes for Controls

  1. Double click on “Convert” button to enter code area. Paste following codes there:
Private Sub btnConvert_Click()
  Dim dTempValue1 As Double, dTempValue1InF As Double, dTempValue2 As Double
  Dim strTempUnit1 As String, strTempUnit2 As String
 
  strTempUnit1 = frmTemperatureConverter.cmbTempUnit1.Text
  strTempUnit2 = frmTemperatureConverter.cmbTempUnit2.Text
 
  dTempValue1 = CDbl(frmTemperatureConverter.txtTempValue1.Value)
 
  Select Case strTempUnit1
    Case "Celsius"
      dTempValue1InF = dTempValue1 * 33.8
    Case "Fahrenheit"
      dTempValue1InF = dTempValue1
    Case "Kelvin"
      dTempValue1InF = dTempValue1 * -457.87
    Case "Rankine"
      dTempValue1InF = dTempValue1 * -458.67
    Case "Delisle"
      dTempValue1InF = dTempValue1 * 1.2
    Case "Newton"
      dTempValue1InF = dTempValue1 * 102.414
    Case "Réaumur"
      dTempValue1InF = dTempValue1 * 34.25
    Case "Rømer"
      dTempValue1InF = dTempValue1 * 3.42857143
  End Select
 
  Select Case strTempUnit2
    Case "Celsius"
      dTempValue2 = dTempValue1InF / 33.8
    Case "Fahrenheit"
      dTempValue2 = dTempValue1InF
    Case "Kelvin"
      dTempValue2 = dTempValue1InF / -457.87
    Case "Rankine"
      dTempValue2 = dTempValue1InF / -458.67
    Case "Delisle"
      dTempValue2 = dTempValue1InF / 1.2
    Case "Newton"
      dTempValue2 = dTempValue1InF / 102.414
    Case "Réaumur"
      dTempValue2 = dTempValue1InF / 34.25
    Case "Rømer"
      dTempValue2 = dTempValue1InF / 3.42857143
  End Select
 
  ' Convert dTempValue2 to string
  If Abs(dTempValue2 - Int(dTempValue2)) > 0.00000001 Then
    frmTemperatureConverter.txtTempValue2.Value = Format(dTempValue2, "###0.00000000")
  Else
    frmTemperatureConverter.txtTempValue2.Value = Format(dTempValue2, "General Number")
  End If
End Sub
  1. Next go to the form and double click “Close” button. Enter codes:
Private Sub btnClose_Click()
  Unload Me
End Sub
  1. Then double click on the form to enter it. You can see 2 combo boxes on the top. Make sure you choose “UserForm” for the left and “Initialize” for the right.Choose "UserForm" for the Left Combo Box and "Initialize" for the Right
  2. And paste codes there, too.
Private Sub UserForm_Initialize()
    cmbTempUnit1.List = Array("Celsius", "Fahrenheit", "Kelvin", "Rankine", "Delisle", _
                        "Newton", "Réaumur", "Rømer")
    cmbTempUnit2.List = Array("Celsius", "Fahrenheit", "Kelvin", "Rankine", "Delisle", _
                        "Newton", "Réaumur", "Rømer")
End Sub
  1. Lastly, save all codes.

Insert a Module

  1. Still in VBA editor, click “Insert” under “Normal” project.
  2. But this time choose “Module”.Click "Normal"->Click "Insert"->Click "Module"
  3. Double click on it to open and paste codes:
Sub TriggerTemperatureConverter()
  frmTemperatureConverter.Show
End Sub

Now run macro “TriggerTemperatureConverter” and you can trigger the converter. You can assign a button for this macro. For detailed steps, refer to this article: How to Remove the Formatting of Pasted Texts with Macro and VBA in Your Word

You can check the video below:

 

Ready for Word Collapse

No matter whether you have experienced data loss or not, you should always make preparation if data disaster occurs. Among all useful tips available, we strongly recommend getting hold of a docx recovery tool in advance.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover excel and pdf repair software products. For more information visit www.datanumen.com

One response to “How to Easily Convert between Various Temperature Units, such as Celsius, Fahrenheit, Kelvin, in Your Word”

  1. This suggestions has actually substantially aided them in browsing such conditions whenever they occur within their connections. There are numerous engaging reasons Ukrainian females look for relationships with foreign guys. There are countless songs Russian women or ukrainian women offered for friendship, dating and serious connections. The Western component often tends to speak Ukrainian specifically while the Eastern prefers Russian. As an example, the European counties record dates in the day format dd/mm/yyyy, while US document dates in the day style mm/dd/yyyy. While the body looked excellent, clients were satisfied with the fit and feel, and the customer press had a lot of advantages to state regarding the new Ford Capri, not everyone was delighted with the cars and truck’s taking care of capabilities. I have actually spent a lot of time trying to automate this however I can not discover a great way to do it. Through this website, any person can locate best companion based on their interests and choice. I recognize it’s EU style due to the fact that “12.05.2017” is May 12th, 2017. In an ideal globe, I would love to run a macro on a column of days that converts this day and adds it to a new column in mm.dd.yyyy AND instantly converts it to a day style.

    4. Which fads provide chances on the European dates market? When we utilize Russian dating sites to satisfy European women, we desire a effective and risk-free day and discover our life companion efficiently and effectively. Lets obtain real here, do you truly believe every women in Ukraine is a stunning bridge design excited to join to a dating website to communicate with Western males, and if you are a sixty year old person, do you really and truthfully believe a stunning young 20 something lady is going to wish to connect with you with a sight to marital relationship? If a girl you are interacting with says she can not connect with you on skype for one reason or another, she is informing you a tale for 100%, all young Ukrainian females make use of Skype regularly, also the older generation use Skype to keep in contact with family and friends. You can have live conversation with Russian ladies or make use of various other ways to get a great understanding prior to informing your essential details. I have actually browsed via the discussion forum and have actually tried a couple of recommended remedies to my issue yet have actually not found success.

    IS N`T one-of-a-kind. Any male with a respectable heart that is looking for a great female to make his spouse can have the very same success that we enjoy. However, understanding the basic tendencies and features of Ukrainian dating culture can give you a strong beginning point and considerably increase your opportunities of success. You can tell your close friends or ask the assistance from the staff of dating sites. Especially pay regard to the odd actions and words from the woman you are dating. However, if such a subject stands out up, do not make a Ukrainian lady jealous as several of your words may press her to believe that she’s worse than your ex-spouse. It is a exceptional and top-rated service since it helps to comprehend and to feel the lady, you don’t have to go overseas to meet a female, to spend a whole lot of cash and to risk. You can use a formula to transform the dates from European to US if the days in the sheet you have gotten are formatted as texts. The season for fresh days is extremely short in creating countries and just a couple of selections are proper for consuming at this phase.

    These top qualities are taken into consideration perfect for any type of woman. Ukrainian ladies are world-renowned for their positive qualities as these women are devoted, faithful, and clever. Ukraine ladies dating is everything about positive emotions, mutual understanding, and interest. In chatting with Russian ladies online, observe very carefully in the initial period. After a period of talking online, you can make some preliminary reasonings concerning the characters of the Russian lady, her life, her line of work, and so on. For reluctant individuals, launching conversations with women can be a nerve-wracking experience. Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Increases your performance by 50%, and reduces numerous computer mouse clicks for you everyday! If you work in a worldwide company, you will obtain sheets from different regions daily which might tape-record days with different day formats. In the lengthy term, the European market for days is expected to reveal secure development. Ensure to lionize.

Leave a Reply

Your email address will not be published. Required fields are marked *