Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default have excel prompt for a file name and save location

I have a macro that parses a table, filters it according to some criteria,
and then copies the filtered records to a new file.

What code can I use to prompt the user to

1) Enter a file name
2) Browse to a specific network location to save the file (which can vary
each time the macro is run)

I'm assuming these two questions would make use of the MsgBox command but
I'm not sure exactly how it would look. Thanks for any hints.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default have excel prompt for a file name and save location

Dave

Dim FileName as String
FileName = Application.GetOpenFileName

The path will be included in the returned value.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Dave F" wrote in message
...
I have a macro that parses a table, filters it according to some criteria,
and then copies the filtered records to a new file.

What code can I use to prompt the user to

1) Enter a file name
2) Browse to a specific network location to save the file (which can vary
each time the macro is run)

I'm assuming these two questions would make use of the MsgBox command but
I'm not sure exactly how it would look. Thanks for any hints.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default have excel prompt for a file name and save location

Thanks for this response but I'm not sure I understand. Let me be more
specific. Here's what I see when I use the macro recorder to record the
action of (1) navigating to a folder and (2) saving the file:

Sub SaveAs1()
'
' SaveAs1 Macro
' Macro recorded 3/20/2007 by David Nevin Friedman
'

'
ChDir "G:\NADC Finance\D Friedman"
ActiveWorkbook.SaveAs Filename:= _
"G:\NADC Finance\D Friedman\ELR Parsed--test.xls",
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub


What I'm trying to figure out is how to make this dynamic; i.e., someone
runs the macro, a dialog box pops up asking the user to navigate to the
desired filepath, and then enter the desired file name.

I'm pretty sure this is possible but I'm not clear on how to do it.

Thanks,

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Earl Kiosterud" wrote:

Dave

Dim FileName as String
FileName = Application.GetOpenFileName

The path will be included in the returned value.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Dave F" wrote in message
...
I have a macro that parses a table, filters it according to some criteria,
and then copies the filtered records to a new file.

What code can I use to prompt the user to

1) Enter a file name
2) Browse to a specific network location to save the file (which can vary
each time the macro is run)

I'm assuming these two questions would make use of the MsgBox command but
I'm not sure exactly how it would look. Thanks for any hints.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 623
Default have excel prompt for a file name and save location

Why don't you try Earl's recommendation before you post a reply? You'll find it
will do exactly what you want.

--
Regards,
Fred


"Dave F" wrote in message
...
Thanks for this response but I'm not sure I understand. Let me be more
specific. Here's what I see when I use the macro recorder to record the
action of (1) navigating to a folder and (2) saving the file:

Sub SaveAs1()
'
' SaveAs1 Macro
' Macro recorded 3/20/2007 by David Nevin Friedman
'

'
ChDir "G:\NADC Finance\D Friedman"
ActiveWorkbook.SaveAs Filename:= _
"G:\NADC Finance\D Friedman\ELR Parsed--test.xls",
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub


What I'm trying to figure out is how to make this dynamic; i.e., someone
runs the macro, a dialog box pops up asking the user to navigate to the
desired filepath, and then enter the desired file name.

I'm pretty sure this is possible but I'm not clear on how to do it.

Thanks,

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Earl Kiosterud" wrote:

Dave

Dim FileName as String
FileName = Application.GetOpenFileName

The path will be included in the returned value.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Dave F" wrote in message
...
I have a macro that parses a table, filters it according to some criteria,
and then copies the filtered records to a new file.

What code can I use to prompt the user to

1) Enter a file name
2) Browse to a specific network location to save the file (which can vary
each time the macro is run)

I'm assuming these two questions would make use of the MsgBox command but
I'm not sure exactly how it would look. Thanks for any hints.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default have excel prompt for a file name and save location

Well I did try the response it prompts me to open a file. I'm not interested
in opening a file. I want to save a file.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Fred Smith" wrote:

Why don't you try Earl's recommendation before you post a reply? You'll find it
will do exactly what you want.

--
Regards,
Fred


"Dave F" wrote in message
...
Thanks for this response but I'm not sure I understand. Let me be more
specific. Here's what I see when I use the macro recorder to record the
action of (1) navigating to a folder and (2) saving the file:

Sub SaveAs1()
'
' SaveAs1 Macro
' Macro recorded 3/20/2007 by David Nevin Friedman
'

'
ChDir "G:\NADC Finance\D Friedman"
ActiveWorkbook.SaveAs Filename:= _
"G:\NADC Finance\D Friedman\ELR Parsed--test.xls",
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub


What I'm trying to figure out is how to make this dynamic; i.e., someone
runs the macro, a dialog box pops up asking the user to navigate to the
desired filepath, and then enter the desired file name.

I'm pretty sure this is possible but I'm not clear on how to do it.

Thanks,

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Earl Kiosterud" wrote:

Dave

Dim FileName as String
FileName = Application.GetOpenFileName

The path will be included in the returned value.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Dave F" wrote in message
...
I have a macro that parses a table, filters it according to some criteria,
and then copies the filtered records to a new file.

What code can I use to prompt the user to

1) Enter a file name
2) Browse to a specific network location to save the file (which can vary
each time the macro is run)

I'm assuming these two questions would make use of the MsgBox command but
I'm not sure exactly how it would look. Thanks for any hints.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default have excel prompt for a file name and save location

Maybe Earl meant:

Dim myFileName as Variant
myfilename = application.GetSaveAsFilename
if myfilename = false then
exit sub 'user hit cancel
end if

Activeworkbook.saveas filename:=myfilename, fileformat:=xlworkbooknormal



Dave F wrote:

Well I did try the response it prompts me to open a file. I'm not interested
in opening a file. I want to save a file.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.

"Fred Smith" wrote:

Why don't you try Earl's recommendation before you post a reply? You'll find it
will do exactly what you want.

--
Regards,
Fred


"Dave F" wrote in message
...
Thanks for this response but I'm not sure I understand. Let me be more
specific. Here's what I see when I use the macro recorder to record the
action of (1) navigating to a folder and (2) saving the file:

Sub SaveAs1()
'
' SaveAs1 Macro
' Macro recorded 3/20/2007 by David Nevin Friedman
'

'
ChDir "G:\NADC Finance\D Friedman"
ActiveWorkbook.SaveAs Filename:= _
"G:\NADC Finance\D Friedman\ELR Parsed--test.xls",
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub


What I'm trying to figure out is how to make this dynamic; i.e., someone
runs the macro, a dialog box pops up asking the user to navigate to the
desired filepath, and then enter the desired file name.

I'm pretty sure this is possible but I'm not clear on how to do it.

Thanks,

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Earl Kiosterud" wrote:

Dave

Dim FileName as String
FileName = Application.GetOpenFileName

The path will be included in the returned value.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Dave F" wrote in message
...
I have a macro that parses a table, filters it according to some criteria,
and then copies the filtered records to a new file.

What code can I use to prompt the user to

1) Enter a file name
2) Browse to a specific network location to save the file (which can vary
each time the macro is run)

I'm assuming these two questions would make use of the MsgBox command but
I'm not sure exactly how it would look. Thanks for any hints.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.







--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default have excel prompt for a file name and save location

Works great, thanks.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Dave Peterson" wrote:

Maybe Earl meant:

Dim myFileName as Variant
myfilename = application.GetSaveAsFilename
if myfilename = false then
exit sub 'user hit cancel
end if

Activeworkbook.saveas filename:=myfilename, fileformat:=xlworkbooknormal



Dave F wrote:

Well I did try the response it prompts me to open a file. I'm not interested
in opening a file. I want to save a file.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.

"Fred Smith" wrote:

Why don't you try Earl's recommendation before you post a reply? You'll find it
will do exactly what you want.

--
Regards,
Fred


"Dave F" wrote in message
...
Thanks for this response but I'm not sure I understand. Let me be more
specific. Here's what I see when I use the macro recorder to record the
action of (1) navigating to a folder and (2) saving the file:

Sub SaveAs1()
'
' SaveAs1 Macro
' Macro recorded 3/20/2007 by David Nevin Friedman
'

'
ChDir "G:\NADC Finance\D Friedman"
ActiveWorkbook.SaveAs Filename:= _
"G:\NADC Finance\D Friedman\ELR Parsed--test.xls",
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub


What I'm trying to figure out is how to make this dynamic; i.e., someone
runs the macro, a dialog box pops up asking the user to navigate to the
desired filepath, and then enter the desired file name.

I'm pretty sure this is possible but I'm not clear on how to do it.

Thanks,

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Earl Kiosterud" wrote:

Dave

Dim FileName as String
FileName = Application.GetOpenFileName

The path will be included in the returned value.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Dave F" wrote in message
...
I have a macro that parses a table, filters it according to some criteria,
and then copies the filtered records to a new file.

What code can I use to prompt the user to

1) Enter a file name
2) Browse to a specific network location to save the file (which can vary
each time the macro is run)

I'm assuming these two questions would make use of the MsgBox command but
I'm not sure exactly how it would look. Thanks for any hints.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.







--

Dave Peterson

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
Prompt for file location and copy data Jim G Excel Discussion (Misc queries) 0 February 27th 07 02:47 AM
Prompt to save file Gloria Setting up and Configuration of Excel 2 May 4th 06 01:09 AM
save prompt for user exit, but no save prompt for batch import? lpj Excel Discussion (Misc queries) 1 February 25th 06 02:08 AM
Prompt for Save when closing a file J. Kerr Excel Discussion (Misc queries) 0 October 5th 05 09:09 PM
how to disable save prompt on closing excel file in automated mode [email protected] Excel Discussion (Misc queries) 3 July 6th 05 10:35 PM


All times are GMT +1. The time now is 10:28 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"