Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default GetSaveAsFilename

Can anyone advise me a method to divert/re-program the 'Save' button
on the GetSaveAsFilename dialog to run my own comma delimited file
saving routine, I need to save specific areas of text values and
formulas from an Excel 2000 worksheet in XP, or will I need to
recreate a facsimile of the file SaveAs form.

Thanks for any help
Oswald
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default GetSaveAsFilename

On 10 Mar, 20:10, Wouter HM wrote:
HiOswald

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


Wouter you are a gem, thank you very much, your code has the simple
elegance I was looking for, this isn't commercial but I will honour
you as the core donor in my VB code.

Oswald
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
GetSaveAsFilename Dave Peterson Excel Programming 0 December 21st 06 04:33 PM
GetSaveAsFilename Syed Zeeshan Haider Excel Programming 2 December 8th 06 06:53 PM
Help with GetSaveAsFilename aj Excel Programming 0 March 23rd 06 08:32 PM
GetSaveasFileName Libby Excel Programming 1 September 8th 05 07:45 PM
GetSaveAsFileName Greg Hadrych Excel Programming 1 July 29th 04 12:52 AM


All times are GMT +1. The time now is 01:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"