macros

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Macro's

Macro's

resolvedResolved · 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 courses

 

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Sorting data stored in rows

Primarily Excel is set up to sort data that is stored in columns rather than rows.

It is possible to get Excel to sort data stored in rows however.

Click in the row you want to sort, or select the cells in the rows you wish to sort.

Go to Data - Sort, then go to the Options button in the bottom left corner of the Sort dialogue box.

View all Excel hints and tips


Server loaded in 0.08 secs.