本文介绍了将vbCrLf应用于文本框的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel vba项目中有一个用户窗体。在设计时它是空的。



在初始化事件表单中,我有以下代码:

  Private Sub UserForm_Initialize()

txtSQL.value = _
SELECT MyName =ColY& vbCrLf& _
FROM SomeTable& vbCrLf& _
GROUP BY顾客& vbCrLf& _
客户DESC订单

结束子

我希望在文本框中有4个单独的文本行,而是具有以下内容:





我使用错误的控件?或者我以错误的方式使用正确的控件?

解决方案

糟糕:也许我应该睡觉...

在设计时将多行属性设置为True!


I've got a userform within an Excel vba project. At design-time it is empty.

In the form initialize event I've got the following code:

Private Sub UserForm_Initialize()

txtSQL.value = _
    "SELECT MyName = ""ColY"" " & vbCrLf & _
    "FROM SomeTable " & vbCrLf & _
    "GROUP BY Customer " & vbCrLf & _
    "ORDER BY Customer DESC"

End Sub

I was hoping for 4 separate lines of text in the textbox but instead have the following:

Am I using the wrong control? Or am I using the right control in the wrong way?

解决方案

Whoops: maybe I should go to bed...

At design-time set multi-line property to True!

这篇关于将vbCrLf应用于文本框的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 23:21