Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default On export option where you want to save

On the macro below where I export the information from excel to .CSV
saves automatically to a predetermined destination. How can I remove
that destination and have an option of an MsgBox ask me the location to
save the .CSV file?

Sub ExportAsCSV()

Dim myRange As Range
Dim curWks As Worksheet
Dim tmpWks As Worksheet

Set curWks = ActiveSheet

With curWks
.Range("B3:L25").AutoFilter field:=1, Criteria1:="<"
If .AutoFilter.Range.Cells.Count 1 Then
Set tmpWks = Workbooks.Add(1).Worksheets(1)
.AutoFilter.Range.EntireRow.Copy _
Destination:=tmpWks.Range("a1")
Application.DisplayAlerts = False
tmpWks.Parent.SaveAs _
Filename:="c:\test.csv", _
FileFormat:=xlCSV
Application.DisplayAlerts = True
tmpWks.Parent.Close savechanges:=False
End If
.AutoFilter.Range.AutoFilter
End With

End Sub

Thank you,

Muaitai

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default On export option where you want to save

Look at Application.GetSaveAsFilename

NickHK

"Muaitai" wrote in message
oups.com...
On the macro below where I export the information from excel to .CSV
saves automatically to a predetermined destination. How can I remove
that destination and have an option of an MsgBox ask me the location to
save the .CSV file?

Sub ExportAsCSV()

Dim myRange As Range
Dim curWks As Worksheet
Dim tmpWks As Worksheet

Set curWks = ActiveSheet

With curWks
.Range("B3:L25").AutoFilter field:=1, Criteria1:="<"
If .AutoFilter.Range.Cells.Count 1 Then
Set tmpWks = Workbooks.Add(1).Worksheets(1)
.AutoFilter.Range.EntireRow.Copy _
Destination:=tmpWks.Range("a1")
Application.DisplayAlerts = False
tmpWks.Parent.SaveAs _
Filename:="c:\test.csv", _
FileFormat:=xlCSV
Application.DisplayAlerts = True
tmpWks.Parent.Close savechanges:=False
End If
.AutoFilter.Range.AutoFilter
End With

End Sub

Thank you,

Muaitai



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
export to excel option - problem [email protected] Excel Discussion (Misc queries) 1 July 25th 07 07:20 AM
export to excel option in IE 6.0 [email protected] Excel Discussion (Misc queries) 0 July 24th 07 04:00 PM
How do I get the data/xml/export option Nick Excel Discussion (Misc queries) 2 August 11th 05 04:21 AM
Export from Oracle into Excel, "Open" is not an option in XP Pierre Excel Discussion (Misc queries) 0 August 4th 05 06:08 PM
Missing "Export to Microsoft Excel" option in Internet Explorer Donna YaWanna Excel Discussion (Misc queries) 0 June 30th 05 12:44 AM


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

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

About Us

"It's about Microsoft Excel"