Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i need to save a file to particular drive or folder 1

Status
Not open for further replies.
Jan 20, 2007
237
US
Hi Guys,
i have this code, i need some help on the below question please

Code:
lcUnit = GETENV("COMPUTERNAME")
SET DEFAULT TO (m.lcFolder)
For lnFile = 1 To Adir(aLnk,"*.lnk")
	lcLink = aLnk[m.lnFile,1]
	loFile = loFolder.ParseName(m.lcLink)
	objLink = loFile.GetLink
	Insert Into DeskLinks Values (m.lcUnit, m.lcLink, objLink.Path)
ENDFOR

Go Top
Browse Normal

i need after the "Browse normal" to add "COPY TO drive\filename type csv" where drive can be any drive i select and pass the "lcunit" value to the "filename", so that way the filename will be saved as whatever is in "lcunit"
so i need to get prompted where to save the csv file, can you please guide me how can i do that ?
Thanks
 
The easiest way to get prompted for a directory is to call GEDIR(). It's very easy:

Code:
lcDir = GETDIR()
IF EMPTY(lcDir)
  * User cancelled
ELSE
  * Everything OK. lcDir now contains the selected directory
ENDIF

Try it and see.

The test for EMPTY() in needed in case the user presses ESC from the directory dialogue, indicating they want to cancel the whole operation.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I don't understand what you are asking in relation to lcUnit. If you want to copy the file (Desklinks?) into the directory that you specified with GETDIR(), and you want the filename to be in whatever is in lcUnit, then you want something like this:

Code:
lcDir = GETDIR()
IF EMPTY(lcDir)
  * User cancelled
ELSE
  * Everything OK. lcDir now contains the selected directory
  SELECT Desklinks
  lcDestination = FORECEPATH(lcUnit, lcDir)
  COPY TO (lcDestination)
ENDIF

If that's not what you want, perhaps you can clarify the question.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,
Yes, that is what i want to be able to select first where to save the file and then use the value in lcunit as the the filename plus use the copy to as COPY TO (lcDestination) type csv so the file gets saved in the location i select with a filename= lcUnit and with the extension .csv, is that what i meant, i have not tested yet but thanks , if what i wrote here is not what i meant your code does, please correct me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top