Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Will only open with FileOpen Command | Excel Discussion (Misc queries) | |||
Open a Workbook using a Command Button | Excel Discussion (Misc queries) | |||
Open Command | Excel Programming | |||
Macro command to open a file | Excel Programming | |||
variable 'open' command | Excel Programming |