Greetings:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
Apologies if this is redundant. It’s half Excel & half Word, so perhaps I’m drifting out of phase a bit here.
<o
></o
>
Nonetheless, yesterday this bit of code worked fine:
<o
></o
>
DocName = CStr(Workbooks("Production Master").Sheets("OR").Range("A" + CStr(i))) 'define DocName for save
<o
></o
>
appWd.ActiveDocument.SaveAs Filename:="C:\Documents and Settings\nwa0tiu\Desktop\NAKA Attachments\" + DocName + ".doc"
<o
></o
>
Today, I get:
“Run-time Error 5152
“This is not a valid file name”
<o
></o
>
I’ve changed nothing. I set appWd as the object (Word.Application), opened the datasource, cleared the locked fields, set the first record . . .
<o
></o
>
Up to this point, it’s a standard mail merge macro. I’m simply retrieving the document name from a worksheet using relevant bits of data; the cell called in the DocName statement is a concatenation of these bits, in text format.
<o
></o
>
I copied the SaveAs path directly from the folder’s address box. When I hover the cursor over the variable DocName, I get the memo window displaying the correct name. Removing the ‘CStr’ solves nothing as well.
<o
></o
>
I am befuddled. Clues? I’m sure it’s something little and dumb.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
Apologies if this is redundant. It’s half Excel & half Word, so perhaps I’m drifting out of phase a bit here.
<o
Nonetheless, yesterday this bit of code worked fine:
<o
DocName = CStr(Workbooks("Production Master").Sheets("OR").Range("A" + CStr(i))) 'define DocName for save
<o
appWd.ActiveDocument.SaveAs Filename:="C:\Documents and Settings\nwa0tiu\Desktop\NAKA Attachments\" + DocName + ".doc"
<o
Today, I get:
“Run-time Error 5152
“This is not a valid file name”
<o
I’ve changed nothing. I set appWd as the object (Word.Application), opened the datasource, cleared the locked fields, set the first record . . .
<o
Up to this point, it’s a standard mail merge macro. I’m simply retrieving the document name from a worksheet using relevant bits of data; the cell called in the DocName statement is a concatenation of these bits, in text format.
<o
I copied the SaveAs path directly from the folder’s address box. When I hover the cursor over the variable DocName, I get the memo window displaying the correct name. Removing the ‘CStr’ solves nothing as well.
<o
I am befuddled. Clues? I’m sure it’s something little and dumb.
Last edited: