Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
2 times file dialog:
Application.GetOpenFilename is called twice: first at FileName = Application.GetOpenFilename then at Workbooks.OpenText FileName:=Application.GetOpenFilename. i recommend prefixing your variables with their type to help distinguish that they are variables and not something else: dim strFileName as string strFileName = Application.GetOpenFilename (FileFilter:=Filt, FilterIndex:=FilterIndex, Title:=Title) Workbooks.OpenText FileName:= strFileName, Origin:=-535, StartRow:=1, ... "skycloud" wrote: Hi all, I had requests: 1. open file dialog to select ASCII file 2. import this file into excel sheet, not open another workbook, is inserted into one worksheet 3. pop-up a message windows to show what file is selected. So what I code: Sub GetImportFile() Dim Filt As String Dim FilterIndex As Integer Dim Title As String Dim FileName As Variant 'Set up list of file filters Filt = "Product Data File (*.pd*),*.pd" 'Display *.* by default FilterIndex = 2 'Set the dialog box caption Title = "Select a Product Data File to Import" 'Get the file name FileName = Application.GetOpenFilename _ (FileFilter:=Filt, _ FilterIndex:=FilterIndex, _ Title:=Title) Workbooks.OpenText FileName:=Application.GetOpenFilename _ (FileFilter:=Filt, FilterIndex:=FilterIndex, Title:=Title), Origin:=-535, StartRow:=1 _ , DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=True, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open/Import ASCII file | Excel Programming | |||
Import selected lines from an Ascii file | Excel Programming | |||
Ascii file import round 3 | Excel Programming | |||
ascii file import round 2 | Excel Programming | |||
Import ascii file | Excel Programming |