![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com