PDA

View Full Version : Default file save location in Powerpernt VBA



Howard Kaikow
04-28-2005, 04:11 AM
Is there a means in PowerPoint VBA to determine the default file save
location?

Better yet, is there a means to change that default location?

MOS MASTER
04-28-2005, 12:57 PM
Hi Howard, :D

If the user has not alterd this path then it is by default %User%MyDocuments

But this no good for you because a user could have changed this and what about foreign languages....

Powerpoint is the least Robust Object model of them all and off course it doesn't provide what you want it to...(A simple Options.DefaultFileLocation = "bla")
That would be to easy.....

If you're up for it then you can off course to you're API Call thing on this challenge (To the options dialog) but there are Two Caveat's:(I can think off)
* Language
* Office 97 the file box is on the Advanced tab (>97 the box is on the Save tab)

Don't envy you doing that.....:bug:

Another possibility is going into the registry and deal with the sucker over there...(not for everybody....be carefull for whome it concerns)

It's just a guess but PP most hold that value somewhere normaly it's in the registry. (Not shure)

I'll do a search for you later if there are better options! :thumb

Howard Kaikow
04-28-2005, 02:46 PM
Hi Howard, :D

If the user has not alterd this path then it is by default %User%MyDocuments

But this no good for you because a user could have changed this and what about foreign languages....

Powerpoint is the least Robust Object model of them all and off course it doesn't provide what you want it to...(A simple Options.DefaultFileLocation = "bla")
That would be to easy.....

If you're up for it then you can off course to you're API Call thing on this challenge (To the options dialog) but there are Two Caveat's:(I can think off)
* Language
* Office 97 the file box is on the Advanced tab (>97 the box is on the Save tab)

Don't envy you doing that.....:bug:

Another possibility is going into the registry and deal with the sucker over there...(not for everybody....be carefull for whome it concerns)

It's just a guess but PP most hold that value somewhere normaly it's in the registry. (Not shure)

I'll do a search for you later if there are better options! :thumb

Best option is the registry, that's easy to do.
But I've decided to just use App.Path in VB 6 for my sample code that sets the VBA passwords.

Too much trouble to hop around when testing if a different directory were to be used for Access, Excel, Powerpernt and Word. Haven't decided yet whether to add Outook.

The password code is common to all, but there's a different front-end for each app, each in a separate command button's code. Just needs a short front end for Outlook.

Oh well, I've been "awake" for about 26 hours, my stomach is growling, gotta eat then try to find my bed.

MOS MASTER
04-28-2005, 02:50 PM
Hi, :D

Yeah PP trully sucks in it's Object model..still hoping on a better sollution then you're App.path...(I'll search tommorow)

For now nighty night to yah! :cloud9:

Howard Kaikow
04-29-2005, 03:29 AM
Best solution may be to retrieve, say, the path from powerpernt's recently used files registry key.

Otherwise, powerpernt seems to default to the Office11 directory, a really dumb default!.

For a VB 6 .exe, App.Path is fine for my sample code, tho noyt in a real app.

MOS MASTER
04-29-2005, 10:39 AM
Hi Howard, :D

If the key is in Recent used file list than you could grab it from there to solve you're question (Didn't check that) if not then I wouldn't go for that approach. :rofl:

I don't agree that it defaults to the Office(8,9,10 or 11) folder at al my machines it defaults to the MyDocuments folder! (Couldn't explain why yours goes somewhere else)

If the right key is not under Recent used file list then I would choose to get the default file save location from Word or any other app you could read it from.

Most people save there documents in the same Root folder and if you can't find the true default than this would be my second best option! :whistle:

Howard Kaikow
04-30-2005, 01:52 PM
Hi Howard, :D

If the user has not alterd this path then it is by default %User%MyDocuments

Where is that documented?


But this no good for you because a user could have changed this and what about foreign languages....

I do not understand. If there's a defined default, I can always get that location from the registry, or somewhere. What "I;am asking is where is that default defined.

I do not see anything in the registry.


Powerpoint is the least Robust Object model of them all and off course it doesn't provide what you want it to...(A simple Options.DefaultFileLocation = "bla")

THe setting has to be saved somewhere, but powerpernt vba may just not let us have access, no pun intended, in the same that access 97 vba is braindead wth regard to vbproject objects.

MOS MASTER
04-30-2005, 01:59 PM
Hi, :D

Have not looked for any documentation on that. It's just a fact that it is on al of my machines.

I also went in the registry and couldn't find it just like you. So that's why i suggested you use the settings of Word as the next best thing! :whistle:

Howard Kaikow
04-30-2005, 02:23 PM
Hi, :D

Have not looked for any documentation on that. It's just a fact that it is on al of my machines.

I also went in the registry and couldn't find it just like you. So that's why i suggested you use the settings of Word as the next best thing! :whistle:

4 me own purposes, it does not matter what is te default, it matters only when i'm putting out general code, as i did today. i've never bee4 released powerpoint code.

it would not be good to have powerpernt dump things in, say word's default directory, unless the user specifically chose this. that's why most apps have a means to specify such defaults, if not thru the gui, then via registry setting. powerpernt seems to have braindead vba.

MOS MASTER
04-30-2005, 02:43 PM
Hi, :D

True PP does have Braindead Object model!

But I can't believe there is no way to gatter this information! I'll do another search tommorow..

And yeas the Word option was a second best thing..witch sucks just as hard offcourse! ;)

Aah this merging feature of the board!
Ok changed the default via the Options/Save tab en looked in the Registry.

This the key I found:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\PowerPoint\RecentFolderLis t

Under the Default, RegExpandSZ I found the Path I just altered. (altered it again and did a registry refresh it changed so it?s the good path)

Seams you can use this one for you?re query?
Must be honest here...it does seam a strange place for this key...the options section would be much easier to find..

Zack Barresse
05-02-2005, 01:44 PM
.. Powerpoint is the least Robust Object model of them all ..

I'll vote for Publisher, actually. ;)

Howard Kaikow
05-02-2005, 07:41 PM
I'll vote for Publisher, actually. ;)

Me 2.

MOS MASTER
05-03-2005, 01:23 PM
I'll vote for Publisher, actually. ;)
I don't :rofl:

If Howard's question was about Publisher then we could beg the differ in showing Publisher does have this little option..(Even in the right Property)

Sub PublicationPath()
MsgBox Application.Options.PathForPublications
End Sub


No my vote for all time VBA Loser must go to InfoPath :p

Howard Kaikow
05-03-2005, 02:37 PM
I don't :rofl:

If Howard's question was about Publisher then we could beg the differ in showing Publisher does have this little option..(Even in the right Property)

Sub PublicationPath()
MsgBox Application.Options.PathForPublications
End Sub


No my vote for all time VBA Loser must go to InfoPath :p

My vote was based on what I recalled about the overall VBA support in Publisher. Of course, I have not checked in a while, but then who says the electorate must be informed?

MOS MASTER
05-03-2005, 02:43 PM
but then who says the electorate must be informed?
Nobody Howard...he should do what ever feels right to him! :rofl:

Killian
05-06-2005, 07:08 AM
Hi Howard,

A bit slow in noticing this thread...
if your looking for a common/consistant place to save files across apps then you could use the FileSystemObject (or WSH) to get the users homedrive and directory (which I believe is how PPT sets it's default on install, though that's more of a hunch than anyhting)Dim fs

Set fs = CreateObject("Scripting.FileSystemObject")
MsgBox Environ("HOMEDRIVE") & Environ("HOMEPATH") I frequently use this (and the "TEMP" and "TMP" settings for temp files) in distributed apps/addins to keep things simple

Howard Kaikow
05-06-2005, 09:13 PM
Hi Howard,

A bit slow in noticing this thread...
if your looking for a common/consistant place to save files across apps then you could use the FileSystemObject (or WSH) to get the users homedrive and directory (which I believe is how PPT sets it's default on install, though that's more of a hunch than anyhting)Dim fs

Set fs = CreateObject("Scripting.FileSystemObject")
MsgBox Environ("HOMEDRIVE") & Environ("HOMEPATH") I frequently use this (and the "TEMP" and "TMP" settings for temp files) in distributed apps/addins to keep things simple

i was looking for powerpernt's default location, not for temp files.

i won't use the scripting library in code/exe/dll to be used by others as hysterically, ooops, historically, auntie-virus software has picked on use of the scripting library.

MOS MASTER
05-07-2005, 02:59 PM
i was looking for powerpernt's default location, not for temp files.

Hi Howard, :D

Am I correct that you won't settle for the Powerpoint path under registry key:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\PowerPoint\RecentFolderLis t?

Or have you found another approach yet..or dropped the thing entirely! :whistle:

Howard Kaikow
05-07-2005, 03:35 PM
Hi Howard, :D

Am I correct that you won't settle for the Powerpoint path under registry key:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\PowerPoint\RecentFolderLis t?

Or have you found another approach yet..or dropped the thing entirely! :whistle:

recentfolderlist is not satisfactory for a default location.

i would choose the default location based on the need of the app on a case by case basis.

MOS MASTER
05-08-2005, 06:16 AM
recentfolderlist is not satisfactory for a default location.
Yes I said that before because I didn't understand yet that it holds the true value of the default filesave path that the user gave in Option/Save tab!

I thought that recentfolderlist was some kind of MRU location and I agree that wouldn't tell you so much!

Under the Default, (Type) RegExpandSZ key you can find the default file save path and I've checked this from 2000/2003 so this is the answer to your question....

So am I not understanding you or are you looking for something else than your orginal question? (Yes I know I'm a nag but I'm sure I'm missing something here)

Howard Kaikow
05-08-2005, 11:57 AM
Yes I said that before because I didn't understand yet that it holds the true value of the default filesave path that the user gave in Option/Save tab!

I thought that recentfolderlist was some kind of MRU location and I agree that wouldn't tell you so much!

Under the Default, (Type) RegExpandSZ key you can find the default file save path and I've checked this from 2000/2003 so this is the answer to your question....

So am I not understanding you or are you looking for something else than your orginal question? (Yes I know I'm a nag but I'm sure I'm missing something here)

I see no RegExpandSZ key.
Could you export that key and show us the result here?

MOS MASTER
05-08-2005, 03:10 PM
I see no RegExpandSZ key.
Could you export that key and show us the result here?
Hi Howard, :D

The reason that your not seeing this Key is that you're PP program has it's defaults set to the path of myDocuments on you're machine. (At least that's what I expect)

I've explained to you that's the default on my machines as well. As long as PP has it's default file save path targeting the special folder mydocuments (Or wathever you're calling this folder on your machine) the RegExpandSZ key will not be visible!

If you alter this path to let's say a subfolder of my documents then this key will appear in the Registry!

I will put a screendump of my key's (2002/2003) tommorow..I'm a bit beat right now....

Please take this little test:
* Open the editor and browse to the key I've specified.
* Go to your computers myfolder and look at it's path
* If there is no such key in the editor than this means your pp default is targeting the same path as special folder mydocuments. (Check this)

* Ok now change the path to a subfolder in mydocuments
* Do a refresh of the Registry editor and tada on all my machines the key appears! (And the big question is does this work for you as wel?)

* Now change the path back to the path of special folder mydocuments on your pc
* Do a refresh and tada...the keys gone!

I'm testing this all on XP SP2 machines with 2002 en 2003 Pro Office on them. (NL and ENG OS versions)

Take the test and please tell me your findings? :whistle:

Howard Kaikow
05-08-2005, 05:08 PM
Hi Howard, :D

The reason that your not seeing this Key is that you're PP program has it's defaults set to the path of myDocuments on you're machine. (At least that's what I expect)

I've explained to you that's the default on my machines as well. As long as PP has it's default file save path targeting the special folder mydocuments (Or wathever you're calling this folder on your machine) the RegExpandSZ key will not be visible!

If you alter this path to let's say a subfolder of my documents then this key will appear in the Registry!

I will put a screendump of my key's (2002/2003) tommorow..I'm a bit beat right now....

Please take this little test:
* Open the editor and browse to the key I've specified.
* Go to your computers myfolder and look at it's path
* If there is no such key in the editor than this means your pp default is targeting the same path as special folder mydocuments. (Check this)

* Ok now change the path to a subfolder in mydocuments
* Do a refresh of the Registry editor and tada on all my machines the key appears! (And the big question is does this work for you as wel?)

* Now change the path back to the path of special folder mydocuments on your pc
* Do a refresh and tada...the keys gone!

I'm testing this all on XP SP2 machines with 2002 en 2003 Pro Office on them. (NL and ENG OS versions)

Take the test and please tell me your findings? :whistle:

Using a key that is not required to exist is a No No in a program.
A program must only use registry keys that MUST exist.

The implication appears to be that if the key does not exist, then it defaults to something, my questions is effectively "What is 'something'?", on my system, "Something" is the Office11 directory. I've neve rchanged any setting in Powerpernt so that must be the default.

MOS MASTER
05-09-2005, 06:24 AM
Hi Howard, :D

Everything seams to work different on my system (I allready discribed what my defaults are)

And if your defaults are also correct then we can assume that this is also a dead lead (The registry key)

Well back to the drawing board...:whistle: