将数字发送到MS Word时,数字对齐更改 [英] The number align change when I send it to MS Word

查看:88
本文介绍了将数字发送到MS Word时,数字对齐更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个功能,当用户按下按钮时,打开Word文档并将数字和日期(日期值为数字而不是数据)发送到Word文档。它工作正常,但当我决定格式化日期值。日期对齐更改。
例如,Access文本框中的日期为96/02/01(Shamsi日期),但是当它发送到Word时,它将更改为01/02/96。我使用了格式化功能,但它不起作用。代码如下:


函数FnWriteToWordDoc()

解决方案

<我担心我对Shamsi日期一无所知,但在我看来,如果你的"txtIndicationDate",是表单上的一个文本框,该文本框以您想要的格式显示值,您可以绕过所有格式并通过引用它将您的Word文档完全插入控件当前显示的文本
.Text属性。 因此,您可以将代码更改为:


    Me.txtIndicationDate.SetFocus&NBSP; '访问.Text属性需要<


    strLetterInfo =" Letter Date:" &安培; Me.txtIndicationDate.Text& vbCrLf& "字母编号:  " &安培; Me.txtIndicatorNumber


这适合你吗?




I have a function that when the user press a button , opens a Word document and send  a number and date (Date value is as Number not data) to the Word Document. It works good but when I decided to Format the date value. The date alignment change. For Example the date in Access text box is as 96/02/01 (Shamsi Date) but when it was send to Word it change to 01/02/96. I used Format function but it doesn't works. The code is as follow:

Function FnWriteToWordDoc()

解决方案

I'm afraid I don't know anything about Shamsi dates, but it seems to me that if your "txtIndicationDate" is a text box on your form, and that text box is displaying the value in the format you want, you can bypass all formatting and insert into your Word document exactly the text that the control is currently displaying, by referencing its .Text property.  So you would change your code to read:

    Me.txtIndicationDate.SetFocus  ' required for access to the .Text property

    strLetterInfo = "Letter Date: " & Me.txtIndicationDate.Text & vbCrLf & "Letter Number:  " & Me.txtIndicatorNumber

Does that come out right for you?


这篇关于将数字发送到MS Word时,数字对齐更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆