Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening Excel2003 files w/macros in 2007 - how? EdS Setting up and Configuration of Excel 1 March 2nd 10 08:02 AM
How do I stop Excel from opening all files w/macros & running them BobC Excel Discussion (Misc queries) 4 April 5th 09 08:25 PM
Auto run of macros immediately after opening the files gane Excel Worksheet Functions 2 October 31st 07 01:41 PM
Using VBA to disable macros when opening files [email protected][_2_] Excel Programming 10 December 13th 05 10:25 PM
Auto run macros when opening CSV files [email protected] Excel Programming 1 September 27th 03 02:38 AM


All times are GMT +1. The time now is 04:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"