我正试着在标签中插入日期。我写了以下代码。我可以通过点击箭头来选择日期,日历就会弹出来。“取消”按钮是有效的,但当我点击“确定”时,我不能让它插入到标签上。标签是包含文本和图像的常规Corel文档。我试着插入一个矩形工具箱,看看是否可以让它使用X,Y坐标在其中插入日期,但这不起作用。我基本上需要知道如何将DTPicker.Value插入到标签上。
Sub ShowIt()
Calendar.Show
End Sub
Private Sub Cancel_Click()
Unload Me
End Sub
Private Sub OK_Click()
a = DTPicker1.Value
b = Format(DTPicker1.Value, "mm/dd/yy")
Unload Me
End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
DTPicker1.Value = Format(DTPicker1.Value, "mm/dd/yy")
End Sub
Private Sub Calendar_Activate()
Me.DTPicker1.Value = Date
End Sub谢谢!
发布于 2015-09-05 22:47:44
尝试以下操作: 1.在宏窗体上添加一个按钮2.选择矩形3.单击按钮4.宏将读取矩形的X,Y位置,然后创建文本并将其定位在矩形的中心
ActiveDocument.ReferencePoint = cdrCenter
XPos = Activeselection.PositionX 'XPos of the rect
YPos = Activeselection.PositionY 'YPos of the rect
Set s = ActiveLayer.CreateArtisticText(0, 0, CStr(Date))
s.PositionX=XPos
s.PositionY=YPos发布于 2015-09-06 13:02:13
尝试运行与您的代码分开的前一段代码。
Sub Macro1()
ActiveDocument.ReferencePoint = cdrCenter
XPos = Activeselection.PositionX
YPos = Activeselection.PositionY
Set s = ActiveLayer.CreateArtisticText(0, 0, CStr(Date))
s.PositionX=XPos
s.PositionY=YPos
End Sub发布于 2015-09-21 16:49:40
下面的代码应该可以按照请求工作:
ActiveDocument.ReferencePoint = cdrCenter
XPos = Activeselection.PositionX 'XPos of the rect
YPos = Activeselection.PositionY 'YPos of the rect
Set s = ActiveLayer.CreateArtisticText(0, 0, CStr(Date))
s.PositionX=XPos
s.PositionY=YPos但是:他没有使用Corel Draw.....:)
https://community.coreldraw.com/talk/coreldraw_community/f/101/t/51007
https://stackoverflow.com/questions/32389241
复制相似问题