Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
browse to open and save as in Excel vbs
I am using Excel2003, now I have a question during my work. I want to use
excel vbs to solve a problem, so I used the record mode to get a macro, the question is: How can I change the vbs code so that when I run the marco, it popup some window message to let me to browse and choose the xls (for I have to deal with many different .xls in the same way) I need, at the end of code, I want a same window popup to ask me to save as. Can you provide me with an example? Thanks very much. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
browse to open and save as in Excel vbs
Hello
See help in VBA on GetOpenFilename and GetSaveAsFilename methods. Dim FileToOpen FileToOpen = Application.GetOpenFilename("Excel Files, *.xls", , "File ?") 'Cancelled If FileToOpen = False Then Exit Sub MsgBox FileToOpen Dim FileToSave FileToSave = Application.GetSaveAsFilename(, "Excel Files, *.xls", , "Save as:") If FileToSave = False Then Exit Sub MsgBox FileToSave HTH Cordially Pascal "seven" a écrit dans le message de news: ... I am using Excel2003, now I have a question during my work. I want to use excel vbs to solve a problem, so I used the record mode to get a macro, the question is: How can I change the vbs code so that when I run the marco, it popup some window message to let me to browse and choose the xls (for I have to deal with many different .xls in the same way) I need, at the end of code, I want a same window popup to ask me to save as. Can you provide me with an example? Thanks very much. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
browse to open and save as in Excel vbs
Hello, papou,
I tried your code, the open function works, however save as seems can not get the results, eg, i open a book1 and then just save it as book2 without any other steps, then no error information, however i can not find book2, So would you please help more? Thank very much for your help! "papou" wrote: Hello See help in VBA on GetOpenFilename and GetSaveAsFilename methods. Dim FileToOpen FileToOpen = Application.GetOpenFilename("Excel Files, *.xls", , "File ?") 'Cancelled If FileToOpen = False Then Exit Sub MsgBox FileToOpen Dim FileToSave FileToSave = Application.GetSaveAsFilename(, "Excel Files, *.xls", , "Save as:") If FileToSave = False Then Exit Sub MsgBox FileToSave HTH Cordially Pascal "seven" a écrit dans le message de news: ... I am using Excel2003, now I have a question during my work. I want to use excel vbs to solve a problem, so I used the record mode to get a macro, the question is: How can I change the vbs code so that when I run the marco, it popup some window message to let me to browse and choose the xls (for I have to deal with many different .xls in the same way) I need, at the end of code, I want a same window popup to ask me to save as. Can you provide me with an example? Thanks very much. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel prob - cant save worksheet if someone has it open in a veiwe | Excel Discussion (Misc queries) | |||
excel prob - cant save worksheet if someone has it open in a veiwe | Excel Worksheet Functions | |||
How do i save all open files in excel at once? | Excel Discussion (Misc queries) | |||
Need to browse 100's of file TITLES in Excel 2000 | Excel Discussion (Misc queries) | |||
Excel 2003 Viewer: No more "Browse in same window" IE functionality? | Excel Discussion (Misc queries) |