Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Prompt for file location and copy data | Excel Discussion (Misc queries) | |||
Prompt to save file | Setting up and Configuration of Excel | |||
save prompt for user exit, but no save prompt for batch import? | Excel Discussion (Misc queries) | |||
Prompt for Save when closing a file | Excel Discussion (Misc queries) | |||
how to disable save prompt on closing excel file in automated mode | Excel Discussion (Misc queries) |