Can I use Analysis Tool Pak functions in my VBA code

Yes, but it takes a few extra steps. In Excel, choose Tools ^ Add-Ins, and place a check mark next to the Analysis ToolPak - VBA add-in. Then activate your VB project and choose Tools^References. Place a check mark next to atpvbaen.xls to create a reference. Then you can use any of the Analysis ToolPak functions in your code. For example, the following statement uses the Analysis ToolPak CONVERT function to convert 5,000 meters to miles:

MsgBox C0NVERT(5000, "m", "mi")

Is there any way to force a line break in the text of a message box?

Use a carriage return or a linefeed character to force a new line. The following statement displays the message box text on two lines. vbCrLf is a built-in constant that represents a carriage return.

MsgBox "Hello" & vbCr & Application.UserName

0 0

Post a comment