View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Wouter HM Wouter HM is offline
external usenet poster
 
Posts: 99
Default 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
 
ExcelBanter Database Error
Database Error Database error
The ExcelBanter database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.excelbanter.com home page, then try to open another page.
  • Click the Back button to try another link.
The www.excelbanter.com forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.