Hello , thank you all for reading my post i really appreciate your DaniWeb it helped me alot before and hope you guys and girls can help me again :
i have a program that genrates a powerpoint slide file -it is name is "presentaion1"- now instead of go to "save as" in the power point menu i want to auto save the genrated presentaion1 to a folder named "MD90" and to change the file name to "MD90-number"
i hope that you guys got the idea i tried to look for an answer but no good i am still a n00b in vb6 ..
thank you for your help

Recommended Answers

All 4 Replies

Hi there,
You simply need to use

FileCopy Source, Destination

In your case that would be

FileCopy "C:\presentation1.ppt", "C:\MD90\MD90-number.ppt"

(Assuming that 'presentation1" was a powerpoint file on the 'C:' drive and that the 'MD90' directory was also on the 'C:' drive)

As you can see, FileCopy allows you to change the filename as well as copy to another location.

If you then wanted to rid yourself of 'presentation1' you would go..

Kill "C:\presentation1.ppt"

Of course you don't have to have the '.ppt' extension but without it the file would be unable to auto start PowerPoint by double clicking on it.

I hope this helps,

Gary O'Connor.

thank you very much for your help in solving my problem i really appreciate your time and effort in doing so.
the presentation1.ppt file is stil opened and not yet saved . how can auto save it to "c:\"
i tried using
code
{
activepresentaion.saveas "C:\presentaion1.ptt" ' but it did not work :(
}

i even tried this :

code
{
activepresentaion.saveas "C:\presentaion1.ptt" ' but still no use :(
}

in addition to the really great weay i learned from your reply .. how can i do the step 1 here .. "how to save the opened presentaion file to C:"
then i can use the copyfile method and i am set with the perfect solution

all the best
cascade

Hi there,
I don't know much about PowerPoint presentations but I do know that, if you call

ActivePresentation.Save

Your ppt file will be saved in the current directory as the name you gave it.

If you really want to you can find out what it's called by calling the

fname=ActivePresentation.FullName

or find out where it is by calling

fpath=ActivePresentation.Path

if these strings are empty then it hasn't been saved so call ActivePresentation.Save

In reality we don't care where the thing is stored so long as we can get the computer to find it, copy it and delete it so, let's have a look at the possible code to accomplish these tasks.

If we were going to use the FileCopy method we would simply go.....

dim fname as string

'find out if it is saved.
fname=ActivePresentation.FullName

'if it hasn't been saved then
If fname="" then

'save the file
ActivePresentation.Save

'Get the file name
fname=ActivePresentation.FullName

end if

'copy it to the MD90-number.ppt
FileCopy fname, "C:\MD90\MD90-number.ppt"

'this next line stops the programme from re-saving the file after we kill it
ActivePresentation.Saved = True

'kill the original file
Kill fname

That way we do all the jobs without ever having to actually know where the original presentation was saved.
I think you will find that will work.

I hope this helps,

Gary O'Connor

thank you for your great help gary and sorry i could not reply faster.

i finally solved it like 4 months ago here you go what i used

'define a powerpoint object -you have to add referance powerpoint
 'object library and graph object library -if you are going
 'to draw graphs- -
dim opptapp as powerpoint.application
'start powerpoint application , make it visible and activated
set opptapp= createobject("powerpoint.application")
opptapp.visible =mscotrue
opptapp.activate

' add a new presentaion 
opptapp.presentations.add(msoctrue)

' saving the presentation 
if "whatsoever" = "whatever" then 
with opptapp.activepresentation
.saveas "C:\new-file",ppsaveaspresntation
end with 
opptapp.activepresentation.close
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.