PDA

View Full Version : Solved: Autosave problem



Brett Desper
05-06-2010, 07:15 AM
We are trying to autosave a document that uses a description that a sales person inputs into word. The code I have works great unless the salesperson puts a period in the description. When this happens, the results are not what we would desire. Is there any easy way to allow the periods in the description? Barring that, is there a way to get rid of the periods in the description. (I can access the text with no trouble).

Again thanks for the help

Brett

Brett Desper
05-06-2010, 08:01 AM
I thought it might be helpful to describe what happened. When the macro saved the file, it took everything after the period as the extension (instead of ".dotx" it was ".00" from the price that was put in - $220.00 and it dropped the rest of the description.) We can try to make it so there are not periods in the description, but it would seem this should be allowable because I can save files as something.something.somethingelse.dotx

Tinbendr
05-06-2010, 01:49 PM
Just a sec.... Ahmmmmm..... Ahmmmmm.... Sorry, not getting anything. :devil2:

Show us the code!

fumei
05-07-2010, 09:10 AM
Exactly.

First of all, does your code put "dotx" explicitly into the filename?

Brett Desper
05-12-2010, 07:49 AM
Sorry for the delay, I am only in two days a week. Here is the save portion of this code.

' save the file
Dim salesman As String, descr As String, day As String
descr = getContent(Application.ActiveDocument, "description")
salesman = getContent(Application.ActiveDocument, "salesman")
day = Format$(Date, "YYYY-MM-DD")
ActiveDocument.SaveAs FileName:="\\cwpdata\quotes\" & salesman & "\" & day & "-" & descr

TonyJollans
05-12-2010, 09:50 AM
As Gerry says .. use:

ActiveDocument.SaveAs FileName:="\\cwpdata\quotes\" & salesman & "\" & day & "-" & descr & ".dotx"

And, if you really want to save as a Template, you should explicitly say so:

ActiveDocument.SaveAs FileName:="\\cwpdata\quotes\" & salesman & "\" & day & "-" & descr & ".dotx" , wdFormatTemplate

Brett Desper
05-12-2010, 01:43 PM
:bow:That did it - thanks. Now I have to write more script to strip the extension off so it can be the subject line for an email message. If it's not something, it's something else. I have the code I need for that though. Thanks again.