98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » Macro's
Macro's
Resolved · High Priority · Version 2007
Paul has attended:
Excel Advanced course
Macro's
Designed macro to enable data formatting from a csv file to be maintainined when saved as excel file ... for the specific file name.
Want to be able to enter in a new csv file name which can be saved into excel.
Simon said he had an associate working on a similar request - the solution on this would be most appreciated!
RE: Macro's
Hi Paul,
Thank you for your question.
I believe the code I was referring to was to open a dialogue box to choose a file.
My colleague won't be able to send you the code until Monday.
I hope this is ok.
Regards
Simon
RE: Macro's
Hi Paul
As requested please find below the code that will open a dialog box so that the user can open a file.
I'm not sure what exactly you want to open, or whether you wish to save an already open file. The code below can be adapted to do all of these things let me know if you need any more help
Dim objFilter As FileDialogFilters
Dim strExcelFile As String
With Application.FileDialog(msoFileDialogOpen)
Set objFilter = .Filters
objFilter.Clear
objFilter.Add "Excel 2003", "*.xls" 'allows for main types of excel workbook
objFilter.Add "Excel 2007", "*.xlsx"
objFilter.Add "Excel 2007 Macro Enabled", "*.xlsm"
.Show
strExcelFile = .SelectedItems(1) 'Picks up path and file name
Application.Workbooks.Open (strExcelFile)
End With
The filters above specify the type of file that the dialog box will display
Regards
Stephen
Tue 8 Dec 2009: Automatically marked as resolved.
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Sorting data stored in rowsPrimarily Excel is set up to sort data that is stored in columns rather than rows. |