View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Custom save as pathname and filename


Your orignal question? Not in this thread.

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Aaron Howe wrote :

I think we may be talking at cross purposes here. If I refer back to
my original question, I was asking how the code would accomodate a
filename which changes depending on how the form is filled out.

Therefore the filepath will always be \\server\fodler\subfolder
but the filename could be
Q12345AB
Q12346AB
Q12347AK
etc etc, and will be different everytime, therefore creating a unique
file for each unique form entry

"keepITcool" wrote:



i posted "pseudo code" illustrating
the use of chdrive/chdir before calling the dialog.
which was what you were asking.

if you wrap it in a sub make sfile an argument
(and make the filefilter more flexible.
'in your form..
Sub CallerinUserform()
Call SaveToMYFolder(txtfilename.Text)
End Sub

'in the forms codemodule or a normal module
Sub SaveToMYFolder(sFile$)
Dim sPath$, sFull$
sPath = "c:\"
ChDrive sPath
ChDir sPath
sFull = Application.GetSaveAsFilename(sFile, ",*." & Right$(sFile,
3)) 'blah blah

End Sub
--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



Aaron Howe wrote :

This works where a contigious name should be given, but the name
will change depending on how the form is filled out... so how do
I adapt:

sFull = Application.GetSaveAsFilename(sFile, "CSV files,*.csv")

to make it the pre-defined name from the string?

"keepITcool" wrote:

Aaron, try:

Sub foo()
Dim sPath$, sFile$, sFull$
sPath = "c:\windows\"
sFile = "text.csv"

ChDrive sPath
ChDir sPath
sFull = Application.GetSaveAsFilename(sFile, "CSV files,*.csv")


End Sub




--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam


Aaron Howe wrote :

I have been trying to enter a code into my sheet which will
save the file to a directory on the network using a
pre-defined file name. My filename is a declared string, and
is working properly. I can get as far as:

* Getting the Save As dialogue in the right folder, but with
no filename * Getting the Save As dialogue to show a name,
not the right one, in the last place I saved
* Getting the Save As dialogue to show the completely wrong
name in the right folder.

Assuming I wanted to do this using the GetSaveAsFilename
option, how would I do it? And how would it differ if I
wanted an automatic save where the user didn't have the
prompt? The end result would have to be:

\\server\folder\subfolder\filenamefromstring.xls

Whichever way it was done...!