ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macros opening files (https://www.excelbanter.com/excel-programming/354039-macros-opening-files.html)

MSHO

macros opening files
 
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

Martin Fishlock[_4_]

macros opening files
 
Try

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

or

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

--
HTHs Martin


"MSHO" wrote:

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


MSHO

macros opening files
 
Thanks so much!

"Martin Fishlock" wrote:

Try

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

or

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

--
HTHs Martin


"MSHO" wrote:

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


Ron de Bruin

macros opening files
 
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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"MSHO" wrote in message ...
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




Ron de Bruin

macros opening files
 
Oops

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

Sorry



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"MSHO" wrote in message ...
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







All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com