Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Change Directory Help!

I am trying to change the Save As directory once a file is open so that
the user automaticly saves the file to a different directory than the
one they opened it in.

Example:
user opens \\serverA\form.xls
user alters the form
on save I need to change the default directory to
\\serverb\form1.xls

Any ideas?

Thanks
Steve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Change Directory Help!

"smonczka" wrote in message
oups.com...
I am trying to change the Save As directory once a file is open so that
the user automaticly saves the file to a different directory than the
one they opened it in.

Example:
user opens \\serverA\form.xls
user alters the form
on save I need to change the default directory to
\\serverb\form1.xls


Hi Steve,

The following very simple Windows API function will set the current
directory to any valid path string:

Private Declare Function SetCurrentDirectoryA _
Lib "kernel32" (ByVal lpPathName As String) As Long

Public Sub SetUNCPath(ByVal szPathToSet As String)
SetCurrentDirectoryA szPathToSet
End Sub

Note that a valid UNC path specification has the form
\\ServerName\ShareName with no file name included. If you pass the API
function an invalid path it will fail silently, so if the current directory
doesn't change as you expect, double check what's in the string you're
passing it.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Change Directory Help!

Rob you just saved me several weeks of work. If I couldn't get this
worked out I was dead in the water. Thanks!

Steve

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Change Directory Help!

Rob,

I made a mistake. I need to change the directory to a HTPP directory
not an UNC dir. The problem is that I have an application that calls
an EXCEL template from within a Sharepoint document library. When the
user fills out the form and saves it, Excel wants to save it back to
the template directory. What I need is to redirect the save as to the
actual library.

What I though I would do is set up an OnOpen macro that changed the
directory. Is this at all possible?

Thanks
Steve

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
change directory to list default edbrog Excel Discussion (Misc queries) 2 January 31st 09 06:19 PM
Change directory Jeff Excel Discussion (Misc queries) 6 September 27th 06 04:08 PM
How can I change list into a directory format? Becky Ed Excel Worksheet Functions 1 August 3rd 06 05:25 PM
change directory for refresh data TxRaistlin Excel Programming 0 February 7th 05 09:21 PM
Change directory for DOS window Garry[_4_] Excel Programming 1 January 9th 04 05:44 PM


All times are GMT +1. The time now is 01:47 PM.

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

About Us

"It's about Microsoft Excel"