macros opening files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I have a macro that prompts the user to open a file. Currently it is a .csv
file but i want it to be able to open .csv or .xls. This is my code:

fileToOpen = Application.GetOpenFilename("Excel Files (*.csv), *.csv")

Is there a way i can add an OR or AND somehow or make it be able to open any
sort of file?

Thanks in Advance
 
Try

fileToOpen = Application.GetOpenFilename( _
"Excel Files (*.csv;*.xls), *.csv;*.xls")

or

fileToOpen = Application.GetOpenFilename( _
"Comma Seperated Value Files (*.csv),*.csv,Excel Files (*.xls),*.xls")
 
Thanks so much!

Martin Fishlock said:
Try

fileToOpen = Application.GetOpenFilename( _
"Excel Files (*.csv;*.xls), *.csv;*.xls")

or

fileToOpen = Application.GetOpenFilename( _
"Comma Seperated Value Files (*.csv),*.csv,Excel Files (*.xls),*.xls")
 
Hi

Try this macro

Sub test()
Application.ScreenUpdating = False
Dim R As Long
Dim rng As Range
Set rng = ActiveSheet.UsedRange
For R = rng.Rows.Count To 1 Step -1
rng.Rows(R + 1).Resize(7).EntireRow.insert
Next R
Application.ScreenUpdating = True
End Sub
 
Oops

This is the second time today I post in the wrong thread

Sorry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top