Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Si Si is offline
external usenet poster
 
Posts: 9
Default Open Command

Ok not sure if I'm in the right place or not.
Excel Programming?

I am building a Macro using (Application.Dialogs(xlDialogOpen).Show)
However what I cannot get it to do is Default to File Type *.csv
IE: When Open box Shows I want it to list All *.csv straight off, instead of
having to select it from File type!
Any Help would be much appreciated!

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Open Command

Si, try this,
Application.GetOpenFilename ("text files, *.csv")


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Si" wrote in message
...
Ok not sure if I'm in the right place or not.
Excel Programming?

I am building a Macro using (Application.Dialogs(xlDialogOpen).Show)
However what I cannot get it to do is Default to File Type *.csv
IE: When Open box Shows I want it to list All *.csv straight off, instead

of
having to select it from File type!
Any Help would be much appreciated!

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
Si Si is offline
external usenet poster
 
Posts: 9
Default Open Command

Yip that worked.
But it seems my problem continues.
In my original Macro I specified the file to open, a *.csv which opened the
file which had selectable cells. Then I select the *.csv cells and had them
CopyPaste into my WorkBook .xls Worked fine when file was specified. But now
with the Open command it Runs and I can see it selecting the area but nothing
appears or is pasted???
Any ideas?
Have not Included top half of Macro this is the starting line.


ChDir "C:\Folder"
Application.GetOpenFilename ("text files, *.csv")
Range("A1:AH19").Select
Selection.Copy
Windows("Workbook.xls").Activate
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("A1").Select
End Sub

The extra is putting the lines back after paste happened

"Paul B" wrote:

Si, try this,
Application.GetOpenFilename ("text files, *.csv")


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Si" wrote in message
...
Ok not sure if I'm in the right place or not.
Excel Programming?

I am building a Macro using (Application.Dialogs(xlDialogOpen).Show)
However what I cannot get it to do is Default to File Type *.csv
IE: When Open box Shows I want it to list All *.csv straight off, instead

of
having to select it from File type!
Any Help would be much appreciated!

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Open Command

Hi Si,

I think the reason is that Excel never actually opens the .csv file in your
macro. Try changing the following:

Dim varCSVfilename As String
ChDir "C:\Folder"
Application.GetOpenFilename ("text files, *.csv")

Workbooks.open varCSVfilename

Hope it helps

"Si" wrote:

Yip that worked.
But it seems my problem continues.
In my original Macro I specified the file to open, a *.csv which opened the
file which had selectable cells. Then I select the *.csv cells and had them
CopyPaste into my WorkBook .xls Worked fine when file was specified. But now
with the Open command it Runs and I can see it selecting the area but nothing
appears or is pasted???
Any ideas?
Have not Included top half of Macro this is the starting line.


ChDir "C:\Folder"
Application.GetOpenFilename ("text files, *.csv")
Range("A1:AH19").Select
Selection.Copy
Windows("Workbook.xls").Activate
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("A1").Select
End Sub

The extra is putting the lines back after paste happened

"Paul B" wrote:

Si, try this,
Application.GetOpenFilename ("text files, *.csv")


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Si" wrote in message
...
Ok not sure if I'm in the right place or not.
Excel Programming?

I am building a Macro using (Application.Dialogs(xlDialogOpen).Show)
However what I cannot get it to do is Default to File Type *.csv
IE: When Open box Shows I want it to list All *.csv straight off, instead

of
having to select it from File type!
Any Help would be much appreciated!

Thanks




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
Will only open with FileOpen Command qforgues Excel Discussion (Misc queries) 0 January 11th 11 05:59 PM
Open a Workbook using a Command Button aussiegirlone Excel Discussion (Misc queries) 2 April 7th 09 03:56 AM
Open Command Jason Zischke Excel Programming 1 March 6th 06 07:17 AM
Macro command to open a file sowetoddid Excel Programming 20 June 10th 04 04:51 PM
variable 'open' command Walt[_2_] Excel Programming 3 July 27th 03 09:06 PM


All times are GMT +1. The time now is 12:15 PM.

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"