PDA

View Full Version : Format date 2010 vs 2007



Novio
01-22-2013, 08:29 AM
Hello,

I have this code
.P_Date = format(Date, "d mmmm yyyy")
It works fine in 2010 but in 2007 I get a error.

I don't no way.

Can anyone help

Tanks

Mark

gmaxey
01-23-2013, 08:21 AM
As best I can tell, that code in any Word version is going to return a compile error "invalid or unqualified reference" This works fine in Word 2003, 2007, 2010, 2013:

Sub ScratchMacro()
P_Date = Format(Date, "d mmmm yyyy")
MsgBox P_Date
End Sub

Novio
01-25-2013, 06:26 AM
Greg,

I will fill the caption from a label with this code. Word 2010 gives no error but 2007 gives the error "invalid or unqualified reference"
Your example works in both versions.

Do you have a other possible solution

Mark

gmaxey
01-25-2013, 06:57 AM
Novio,

Again. the following code will not compile in any Word version without a valid or qualified reference:

Sub Test()
.P_Date = Format(Date, "d mmmm yyyy")
End Sub

If it compilies for you then you must have a reference for it in your Word 2010 application that you don't have in your Word 2007 application. Have you compared available references?