Excel Automation中的日期标题 [英] Date Header in Excel Automation
问题描述
在我创建的excel自动化中,需要日期标头,
objSheet.Range("A4:E4").NumberFormat =自"&格式(RM.mDate,"mmmm d,yyyy")
并会被视为截至2012年1月2日"
但是,当我运行Excel Automation时,显示为"2012年1月2日的A0".
在Excel中,我尝试执行设置单元格格式",选择自定义".
相同的"2012年1月2日的A0".
如何将其显示为截至2012年1月2日"?
另外,在创建Excel工作表后,将其设置为visible = true,将显示该工作簿,但是会出现一个SAVE弹出窗口,该如何消除呢?
这是代码;
In the excel automation i''m creating, a date header is required,
objSheet.Range("A4:E4").NumberFormat = "As Of " & Format(RM.mDate, "mmmm d, yyyy")
and will be viewed like "As Of January 2, 2012"
But, when I run Excel Automation, this is displayed "A0 of January 2, 2012".
In Excel, I tried doing Format Cells, selected Custom..
the same "A0 of January 2, 2012".
How can I displayed it as "As of January 2, 2012"?
Also, after creating an Excel Worksheet, I set it to visible = true, the workbook shows, but a SAVE popup window appears, how can I eliminate that?
this is the code ;
objApp.Visible = True = workbook appears.
range = Nothing
objSheet = Nothing
objSheets = Nothing
objBooks = Nothing
objApp.Quit()
objApp = Nothing
另外,如何防止显示FileDialog或如何从Filedialog中选择取消"?因此,当自动化完成并显示excel时,将不会出现FileDialog.
Also, how can i prevent the FileDialog from showing or how can I select "Cancel" from the Filedialog?, so that when the automation is done, and excel shows, no FileDialog will appear.
推荐答案
截止日期"不是数字格式.
创建所需的日期格式,然后解析为文本并与截止日期"串联.
将结果文本用作单元格值.
"As Of" is not a number format.
Create the date formate you want, then parse as text and concatenate with "As Of".
Use that resultant text as the cell value.
这篇关于Excel Automation中的日期标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!