Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default Save to My Docs

Hi,

Is there a code for automatically saving a copy of a file to My Documents on
any computer?

So I create a file which I put on a network with a macro button. Anyone who
hits the button will then have a copy of file saved onto the My Docs of their
computer. I will also do other things with the operation but the save bit I
dont know how to do.

Thanks
LiAD
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Save to My Docs

This link may be useful

http://www.hotscripts.com/forums/vis...ents-path.html
--
If this post helps click Yes
---------------
Jacob Skaria


"LiAD" wrote:

Hi,

Is there a code for automatically saving a copy of a file to My Documents on
any computer?

So I create a file which I put on a network with a macro button. Anyone who
hits the button will then have a copy of file saved onto the My Docs of their
computer. I will also do other things with the operation but the save bit I
dont know how to do.

Thanks
LiAD

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Save to My Docs

In a new module paste the below API function and then within a macro call
Msgbox SpecFolder(CSIDL_PERSONAL)


Public Declare Function SHGetSpecialFolderLocation Lib "shell32" (ByVal hWnd
As Long, ByVal nFolder As Long, ppidl As Long) As Long
Public Declare Function SHGetPathFromIDList Lib "shell32" Alias
"SHGetPathFromIDListA" (ByVal Pidl As Long, ByVal pszPath As String) As Long
Public Declare Sub CoTaskMemFree Lib "ole32" (ByVal pvoid As Long)
Public Const CSIDL_PERSONAL = &H5
Public Const CSIDL_DESKTOPDIRECTORY = &H10
Public Const MAX_PATH = 260
Public Const NOERROR = 0

Public Function SpecFolder(ByVal lngFolder As Long) As String
Dim lngPidlFound As Long
Dim lngFolderFound As Long
Dim lngPidl As Long
Dim strPath As String

strPath = Space(MAX_PATH)
lngPidlFound = SHGetSpecialFolderLocation(0, lngFolder, lngPidl)
If lngPidlFound = NOERROR Then
lngFolderFound = SHGetPathFromIDList(lngPidl, strPath)
If lngFolderFound Then
SpecFolder = Left$(strPath, InStr(1, strPath, vbNullChar) - 1)
End If
End If
CoTaskMemFree lngPidl
End Function

If this post helps click Yes
---------------
Jacob Skaria


"LiAD" wrote:

Hi,

Is there a code for automatically saving a copy of a file to My Documents on
any computer?

So I create a file which I put on a network with a macro button. Anyone who
hits the button will then have a copy of file saved onto the My Docs of their
computer. I will also do other things with the operation but the save bit I
dont know how to do.

Thanks
LiAD

  #4   Report Post  
Posted to microsoft.public.excel.programming
PJ PJ is offline
external usenet poster
 
Posts: 112
Default Save to My Docs

You can use the "ENVIRON" function to get the MyDocs location of the
currently logged on user. Set your save path to something like so:

Environ("USERPROFILE") + "\My Documents"

HTH - PJZ

"LiAD" wrote:

Hi,

Is there a code for automatically saving a copy of a file to My Documents on
any computer?

So I create a file which I put on a network with a macro button. Anyone who
hits the button will then have a copy of file saved onto the My Docs of their
computer. I will also do other things with the operation but the save bit I
dont know how to do.

Thanks
LiAD

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
Excell docs save with a 1 added on. Kennyb Excel Discussion (Misc queries) 5 July 13th 08 12:45 AM
need macro to save HTML pages as PDF docs nanda Excel Programming 0 November 3rd 07 09:37 AM
Excel docs not saving as excel docs Beth Excel Discussion (Misc queries) 6 September 12th 06 02:39 AM
Embedding Word Docs into Excel Worksheets and Then Printing The Word Docs mr_melvis Excel Worksheet Functions 1 April 8th 05 03:00 AM
converting excel docs to word docs rolercster New Users to Excel 2 January 4th 05 07:11 PM


All times are GMT +1. The time now is 01:27 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"