GetSaveAsFilename
Hi Oswald
In Excel 2003 I created the code below.
As far as I know there are no changes in the VBA between 2002 and
2003.
Sub OswladSave()
Dim strFilename As String
Dim lngRow As Long
Dim lngCol As Long
Dim lngFree As Long
Dim strRow As String
strFilename = Application.GetSaveAsFilename
' When cancel is clikced
If strFilename = "False" Then Exit Sub
lngFree = FreeFile
Open strFilename For Output As lngFree
For lngRow = 1 To Selection.Rows.Count
strRow = ""
For lngCol = 1 To Selection.Columns.Count
If lngCol 1 Then
strRow = strRow & ","
End If
strRow = strRow & _
CStr(Selection.Cells(lngRow, lngCol).Value)
Next
Print #lngFree, strRow
Next
Close #lngFree
End Sub
HTH,
Wouter
|