Hello all, Looking for a little help all the examples in MSDN have

Doc.saveas("Myfile.doc")

I want to use a variable and haveing tried such, it is just not
working.

doc.saveas(strMyDocs & "\" & ResID & ".doc")

I have tried stuffing all into one variable and splitting it out into
many but to no avail.
but if I hardcode it ....
All the variables have the correct data
I am thinking that as soon as SAVEAS is called the Vars loose their
ohhh whats the word.... "scope"/"meaning" ..

There has to be a way around this

Thanks in adavance to any and all that assist

Re: SaveAs method not Working by Richard

Richard
Wed May 09 13:01:38 CDT 2007


<Kman_59624@yahoo.com> wrote in message
news:1178730471.533045.227690@e65g2000hsc.googlegroups.com...
> Hello all, Looking for a little help all the examples in MSDN have
>
> Doc.saveas("Myfile.doc")
>
> I want to use a variable and haveing tried such, it is just not
> working.
>
> doc.saveas(strMyDocs & "\" & ResID & ".doc")
>
> I have tried stuffing all into one variable and splitting it out into
> many but to no avail.
> but if I hardcode it ....
> All the variables have the correct data
> I am thinking that as soon as SAVEAS is called the Vars loose their
> ohhh whats the word.... "scope"/"meaning" ..
>

I've never had problems with SaveAs (Excel objects), but I believe the file
name should not be in parentheses (unless you Call the SaveAs method). Try:

doc.saveas strMyDocs & "\" & ResID & ".doc"

Makes sure the argument is a valid filename, and if not in the current
folder, a valid path and file name. The file should not exist, or you will
be asked if you want to replace the existing file. To troubleshoot, use:

Wscript.Echo strMyDocs & "\" & ResID & ".doc"

to make sure the argument is valid. Also, after saving, I would close the
document and quit the application. Otherwise, the document can be held open
in memory, which causes problems such as not being able to save. You might
use Task Manager to make sure Word (or whatever app) is not running in
memory, holding the file open.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--



Re: SaveAs method not Working by Kman_59624

Kman_59624
Wed May 09 13:06:11 CDT 2007

On May 9, 1:01 pm, "Richard Mueller [MVP]" <rlmueller-
nos...@ameritech.nospam.net> wrote:
> <Kman_59...@yahoo.com> wrote in message
>
> news:1178730471.533045.227690@e65g2000hsc.googlegroups.com...
>
>
>
>
>
> > Hello all, Looking for a little help all the examples in MSDN have
>
> >Doc.saveas("Myfile.doc")
>
> > I want to use a variable and haveing tried such, it is just not
> > working.
>
> >doc.saveas(strMyDocs & "\" & ResID & ".doc")
>
> > I have tried stuffing all into one variable and splitting it out into
> > many but to no avail.
> > but if I hardcode it ....
> > All the variables have the correct data
> > I am thinking that as soon as SAVEAS is called the Vars loose their
> > ohhh whats the word.... "scope"/"meaning" ..
>
> I've never had problems with SaveAs (Excel objects), but I believe the file
> name should not be in parentheses (unless you Call the SaveAs method). Try:
>
> doc.saveasstrMyDocs & "\" & ResID & ".doc"
>
> Makes sure the argument is a valid filename, and if not in the current
> folder, a valid path and file name. The file should not exist, or you will
> be asked if you want to replace the existing file. To troubleshoot, use:
>
> Wscript.Echo strMyDocs & "\" & ResID & ".doc"
>
> to make sure the argument is valid. Also, after saving, I would close the
> document and quit the application. Otherwise, the document can be held open
> in memory, which causes problems such as not being able to save. You might
> use Task Manager to make sure Word (or whatever app) is not running in
> memory, holding the file open.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab -http://www.rlmueller.net
> --- Hide quoted text -
>
> - Show quoted text -

Thanks I will give it a shot and all the other items are all ready
there , left them out for neatness (fairly big script) .



Re: SaveAs method not Working by Kman_59624

Kman_59624
Thu May 10 11:57:08 CDT 2007

The Above did not work but.....
It got me thinking about the actual value in the var,
Length showed me lets say 10,
then for kicks i ran it through a little char validation check and
what do you know there were 4 preceding somethings(dont know what they
were as i just converted them to ~, lenght then showed 14. Well
anyway all is working now.

Thank you for the idea.