vb code works in word 97 but not word 2003

R

red6000

I have the following code:

ActiveDocument.SaveAs FileName:="My File" + format(Now, "dd mm yy hh mm ss")

which works perfectly in word 97, but when run in word 2003 it gives the
error:

Compile error:
Wrong number of arguments or invalid property assingment.

Can anyone help on how to get this to work in word 2003.

Thanks.
 
J

Jezebel

You're adding a number to a string where you should be concatenating -- the
result is thus not a string, which is the required argument type. Try

ActiveDocument.SaveAs FileName:="My File" & format$(Now, "dd mm yy hh mm
ss")
 
R

red6000

Jezebel said:
You're adding a number to a string where you should be concatenating --
the result is thus not a string, which is the required argument type. Try

ActiveDocument.SaveAs FileName:="My File" & format$(Now, "dd mm yy hh mm
ss")

Thanks, but if I use that I now get;

Compile error:

Type-declaration character does not match declared data type.
 
H

Howard Kaikow

Jezebel said:
You're adding a number to a string where you should be concatenating -- the
result is thus not a string, which is the required argument type. Try

ActiveDocument.SaveAs FileName:="My File" & format$(Now, "dd mm yy hh mm
ss")

Although the OP should be using an & instead of a +, that's not the problem
here.

The statement presented works properly in Word 2003 with either the + or the
&.
Some other statement is causing the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top