View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] meyvn77@yahoo.com is offline
external usenet poster
 
Posts: 2
Default HELP! Programmicly Save an Excel File ?


Solved my own problem

Solution.. Record a macro and stick it on a button.

Dim plGetPathString As String
Dim filepath As String

plGetPathString = ""
filepath = Trim$(ActiveWorkbook.FullName)

While InStr(filepath, "\")
plGetPathString = plGetPathString & Left$(filepath,
InStr(filepath, "\"))
filepath = Mid$(filepath, InStr(filepath, "\") + 1)
Wend
If Len(Dir("" & plGetPathString & "Selection_Set.xls")) 1 Then
'MsgBox "file exists"
ActiveWorkbook.SaveAs Filename:="" & plGetPathString &
"Selection_Set_" & Rnd() & ".xls", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False, Accessmode:=xlNoChange,
ConflictResolution:=xlUserResolution
Else
ActiveWorkbook.SaveAs Filename:="" & plGetPathString &
"Selection_Set.xls", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False, Accessmode:=xlNoChange,
ConflictResolution:=xlUserResolution
End If