Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 ;

VB
objApp.Visible = True = workbook appears.

 range = Nothing
 objSheet = Nothing
 objSheets = Nothing
 objBooks = Nothing
 objApp.Quit()
 objApp = Nothing


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.
Posted
Updated 25-Jan-12 22:47pm
v4
Comments
Dalek Dave 26-Jan-12 4:49am    
Edited for Code Block

1 solution

"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.
 
Share this answer
 
Comments
Alan Tuscano 30-Jan-12 22:09pm    
sorry for the reply, tnx Dalek.. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900