Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default Auto Importing of new files

I have the following codes written to ask my operator to select the file from
a folder and import it repeatively. Now I want the import to be automatic
after 1min and it will automatic import the newest file in the folder. How
should I do it? Thanks.

Sub ImportSlitting()

Dim myFileName As Variant

Do
myFileName = Application.GetOpenFilename( _
filefilter:="Text Files, *.Txt", Title:="Locate & Select
the Reel")
If myFileName = False Then
MsgBox "End of Import. Copy Data to Slitting Summary.xls" 'user
hit cancel
Else
With ActiveSheet.QueryTables.Add( _
Connection:="TEXT;" & myFileName, _
Destination:=Range("A1"))

.Name = "107074 r02 s01-2006-04-18-0102 PM"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(9, 1, 9, 1, 9, 1, 9, 1, 9)
.TextFileFixedColumnWidths = Array(2, 8, 7, 6, 30, 5, 17, 6)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

End If

Loop Until myFileName = False

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default Auto Importing of new files

Anybody who knows please help! Thanks.

"Martin" wrote:

I have the following codes written to ask my operator to select the file from
a folder and import it repeatively. Now I want the import to be automatic
after 1min and it will automatic import the newest file in the folder. How
should I do it? Thanks.

Sub ImportSlitting()

Dim myFileName As Variant

Do
myFileName = Application.GetOpenFilename( _
filefilter:="Text Files, *.Txt", Title:="Locate & Select
the Reel")
If myFileName = False Then
MsgBox "End of Import. Copy Data to Slitting Summary.xls" 'user
hit cancel
Else
With ActiveSheet.QueryTables.Add( _
Connection:="TEXT;" & myFileName, _
Destination:=Range("A1"))

.Name = "107074 r02 s01-2006-04-18-0102 PM"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(9, 1, 9, 1, 9, 1, 9, 1, 9)
.TextFileFixedColumnWidths = Array(2, 8, 7, 6, 30, 5, 17, 6)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

End If

Loop Until myFileName = False

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Auto Importing of new files

http://j-walk.com/ss/excel/tips/tip97.htm


Martin wrote:
Anybody who knows please help! Thanks.

"Martin" wrote:

I have the following codes written to ask my operator to select the file from
a folder and import it repeatively. Now I want the import to be automatic
after 1min and it will automatic import the newest file in the folder. How
should I do it? Thanks.

Sub ImportSlitting()

Dim myFileName As Variant

Do
myFileName = Application.GetOpenFilename( _
filefilter:="Text Files, *.Txt", Title:="Locate & Select
the Reel")
If myFileName = False Then
MsgBox "End of Import. Copy Data to Slitting Summary.xls" 'user
hit cancel
Else
With ActiveSheet.QueryTables.Add( _
Connection:="TEXT;" & myFileName, _
Destination:=Range("A1"))

.Name = "107074 r02 s01-2006-04-18-0102 PM"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(9, 1, 9, 1, 9, 1, 9, 1, 9)
.TextFileFixedColumnWidths = Array(2, 8, 7, 6, 30, 5, 17, 6)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

End If

Loop Until myFileName = False

End Sub


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
importing .prn files jroth Excel Discussion (Misc queries) 2 May 20th 08 03:09 PM
Importing CSV files nnappy Excel Discussion (Misc queries) 1 June 19th 06 06:42 PM
importing XML, auto formatting smoran Excel Discussion (Misc queries) 0 October 4th 05 11:19 AM
Importing .bas files Joel Excel Programming 4 March 24th 05 04:14 PM
Importing files Dan E[_2_] Excel Programming 1 July 16th 03 04:53 PM


All times are GMT +1. The time now is 10:56 AM.

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

About Us

"It's about Microsoft Excel"