Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello all! I had posted a message here, and I do not believe it was
answered. Maybe it fell through the cracks (very possible as there are bunches of posts a day) or maybe it was deleted because someone found the secret communist anti-France satanic message hidden carefully within the subject title. Or maybe you people have answered this same question about 500 times and didn't want to answer it a 501st time. Well...sorry, but I fear I must bother you again. If I missed the post and someone DID answer me, sorry, but I missed it. My Question: Does anyone know how I can get a spreadsheet to save to desktop consistently on an NT based system where user name might be different? If I do not put anyfile path in my macro, it saves it to the users documents folder. is there a way i might be able to backstep to desktop from there? or is there a way i can just say "userDesktop" or something? Or will I need to somehow find the active username and add it into a filename string like {"C:\Documents and Settings\" & UserName & "\Desktop\" & DForm.DSave & ".xls"}? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 26 Feb 2004 12:24:02 -0800, BOHICA wrote:
Hello all! I had posted a message here, and I do not believe it was answered. Maybe it fell through the cracks (very possible as there are bunches of posts a day) or maybe it was deleted because someone found the secret communist anti-France satanic message hidden carefully within the subject title. Or maybe you people have answered this same question about 500 times and didn't want to answer it a 501st time. Well...sorry, but I fear I must bother you again. If I missed the post and someone DID answer me, sorry, but I missed it. My Question: Does anyone know how I can get a spreadsheet to save to desktop consistently on an NT based system where user name might be different? If I do not put anyfile path in my macro, it saves it to the users documents folder. is there a way i might be able to backstep to desktop from there? or is there a way i can just say "userDesktop" or something? Or will I need to somehow find the active username and add it into a filename string like {"C:\Documents and Settings\" & UserName & "\Desktop\" & DForm.DSave & ".xls"}? Thanks (This isn't the same BOHICA from the Girly tagboard, is it?) The easiest, but not always accurate, way is to use Environ("USERPROFILE") - this returns the absolute path to the current user's profile. For the desktop do this: desk$ = Environ("USERPROFILE") & "\Desktop" "MDW" gave an easier way to do this, in response to your previous post: Set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") ....but for this to work in Excel, you need to add a reference to the "Windows Script Host Object Model" (in the VBA editor: Tools menu - References) and then change the code to something like this: Dim wsh As WshShell 'can't use WshShell as a var - it's a class strDesktop = wsh.SpecialFolders("Desktop") This assumes that Windows Scripting is installed, which is pretty safe, unless you have users running Win95 without IE4+ installed. If you do, just pull it straight from the registry: HKCU\Software\Microsoft\Windows\CurrentVersion\Exp lorer\Shell Folders ....retrieve the string value "Desktop". -- auric "underscore" "underscore" "at" hotmail "dot" com ***** Things worth having are worth cheating for. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thu, 26 Feb 2004 14:30:27 -0700, I wrote:
"MDW" gave an easier way to do this, in response to your previous post: Correction: not easier, BETTER. -- auric "underscore" "underscore" "at" hotmail "dot" com ***** 640k = 4480 in dog bytes. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bohica
the reply from MDW to your earlier post: "MDW" wrote in message ... This should return the location of the desktop. I use it in VBScript, I don't know what modifications (if any) you would need to make it work in Excel. Set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") Regards Trevor "BOHICA" wrote in message om... Hello all! I had posted a message here, and I do not believe it was answered. Maybe it fell through the cracks (very possible as there are bunches of posts a day) or maybe it was deleted because someone found the secret communist anti-France satanic message hidden carefully within the subject title. Or maybe you people have answered this same question about 500 times and didn't want to answer it a 501st time. Well...sorry, but I fear I must bother you again. If I missed the post and someone DID answer me, sorry, but I missed it. My Question: Does anyone know how I can get a spreadsheet to save to desktop consistently on an NT based system where user name might be different? If I do not put anyfile path in my macro, it saves it to the users documents folder. is there a way i might be able to backstep to desktop from there? or is there a way i can just say "userDesktop" or something? Or will I need to somehow find the active username and add it into a filename string like {"C:\Documents and Settings\" & UserName & "\Desktop\" & DForm.DSave & ".xls"}? Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
WOOOHOOO! It works! Thanks goes out to you two brainiacs. Thank you
kindly for the help. Oh, and no I am not the same BOHICA from the girly tagboards, as the only skirt I wear is my kilt. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 2 Mar 2004 08:32:58 -0800, BOHICA wrote:
WOOOHOOO! It works! Thanks goes out to you two brainiacs. Thank you kindly for the help. Oh, and no I am not the same BOHICA from the girly tagboards, as the only skirt I wear is my kilt. Girly is a *comic strip*. <g -- auric "underscore" "underscore" "at" hotmail "dot" com ***** We should be watching each other's backs, instead of watching our own backs against each other. -- SickRick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|