Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default BOHICA needs help!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default BOHICA needs help!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default BOHICA needs help!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default BOHICA needs help!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default BOHICA needs help!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default BOHICA needs help!

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"