Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Amend open Workbook code

This statement opens a 'text' file:
Workbooks.OpenText Filename:= _
"C:\BofQProject\Cato Import\B005A__1.EBQ", _
Origin:=xlWindows, StartRow:=13, _
DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(13, 2), Array(71, 1), _
Array(73, 1), Array(109, 1))

I have this code which will get all files in a chosen folder:
FName = (SourceDir & "\" & "*.EBQ")
FName = Dir(FName)
Do While Len(FName) 0
FileCounter = FileCounter + 1
ReDim Preserve FilesArray(1 To FileCounter)
FilesArray(FileCounter) = FName
FName = Dir()
Loop

How do I amend the following to open each workbook
in turn, please?

If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.Open vFilename & FilesArray(LoopCounter), False

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.577 / Virus Database: 366 - Release Date: 03/02/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Amend open Workbook code

Stuart,

Do you just want to open them?

If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.Open vFilename & FilesArray(LoopCounter), False
Next
End If

Not sure what vFilename is


Or do you want to open them as text files?

If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.OpenText Filename:= _
FilesArray(LoopCounter), _
Origin:=xlWindows, StartRow:=13, _
DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(13, 2), Array(71, 1), _
Array(73, 1), Array(109, 1))
Next
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Stuart" wrote in message
...
This statement opens a 'text' file:
Workbooks.OpenText Filename:= _
"C:\BofQProject\Cato Import\B005A__1.EBQ", _
Origin:=xlWindows, StartRow:=13, _
DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(13, 2), Array(71, 1), _
Array(73, 1), Array(109, 1))

I have this code which will get all files in a chosen folder:
FName = (SourceDir & "\" & "*.EBQ")
FName = Dir(FName)
Do While Len(FName) 0
FileCounter = FileCounter + 1
ReDim Preserve FilesArray(1 To FileCounter)
FilesArray(FileCounter) = FName
FName = Dir()
Loop

How do I amend the following to open each workbook
in turn, please?

If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.Open vFilename & FilesArray(LoopCounter), False

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.577 / Virus Database: 366 - Release Date: 03/02/2004




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Amend open Workbook code


vFilename = SourceDir & "\"
FName = (SourceDir & "\" & "*.EBQ")
FName = Dir(FName)
Do While Len(FName) 0
FileCounter = FileCounter + 1
ReDim Preserve FilesArray(1 To FileCounter)
FilesArray(FileCounter) = FName
FName = Dir()
Loop
If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.OpenText Filename:= _
vFilename & FilesArray(LoopCounter), _
Origin:=xlWindows, StartRow:=13, _
DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(13, 2), Array(71, 1), _
Array(73, 1), Array(109, 1))
Next
Application.ScreenUpdating = True
End If


--
Regards,
Tom Ogilvy


Stuart wrote in message
...
This statement opens a 'text' file:
Workbooks.OpenText Filename:= _
"C:\BofQProject\Cato Import\B005A__1.EBQ", _
Origin:=xlWindows, StartRow:=13, _
DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(13, 2), Array(71, 1), _
Array(73, 1), Array(109, 1))

I have this code which will get all files in a chosen folder:
FName = (SourceDir & "\" & "*.EBQ")
FName = Dir(FName)
Do While Len(FName) 0
FileCounter = FileCounter + 1
ReDim Preserve FilesArray(1 To FileCounter)
FilesArray(FileCounter) = FName
FName = Dir()
Loop

How do I amend the following to open each workbook
in turn, please?

If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.Open vFilename & FilesArray(LoopCounter), False

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.577 / Virus Database: 366 - Release Date: 03/02/2004




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Amend open Workbook code

Need to open them as text files, but in that
specific delimited way.

Many thanks to you both.

Regards.

"Bob Phillips" wrote in message
...
Stuart,

Do you just want to open them?

If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.Open vFilename & FilesArray(LoopCounter), False
Next
End If

Not sure what vFilename is


Or do you want to open them as text files?

If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.OpenText Filename:= _
FilesArray(LoopCounter), _
Origin:=xlWindows, StartRow:=13, _
DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(13, 2), Array(71, 1), _
Array(73, 1), Array(109, 1))
Next
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Stuart" wrote in message
...
This statement opens a 'text' file:
Workbooks.OpenText Filename:= _
"C:\BofQProject\Cato Import\B005A__1.EBQ", _
Origin:=xlWindows, StartRow:=13, _
DataType:=xlFixedWidth, FieldInfo:= _
Array(Array(0, 1), Array(13, 2), Array(71, 1), _
Array(73, 1), Array(109, 1))

I have this code which will get all files in a chosen folder:
FName = (SourceDir & "\" & "*.EBQ")
FName = Dir(FName)
Do While Len(FName) 0
FileCounter = FileCounter + 1
ReDim Preserve FilesArray(1 To FileCounter)
FilesArray(FileCounter) = FName
FName = Dir()
Loop

How do I amend the following to open each workbook
in turn, please?

If FileCounter 0 Then
Application.ScreenUpdating = False
For LoopCounter = 1 To FileCounter
Workbooks.Open vFilename & FilesArray(LoopCounter), False

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.577 / Virus Database: 366 - Release Date: 03/02/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.577 / Virus Database: 366 - Release Date: 03/02/2004


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
amend a VB code please Morgan Excel Discussion (Misc queries) 0 March 3rd 10 11:17 PM
Amend the DV0022 - Update Validation Selections code for more lists [email protected] Excel Worksheet Functions 1 January 4th 09 01:19 PM
Help on writing a code to copy and amend lines Karen Brown[_2_] Excel Programming 2 February 5th 04 05:51 PM
Amend code or change it completely? Gareth[_3_] Excel Programming 2 December 1st 03 07:24 PM
Amend form code to allow an option Stuart[_5_] Excel Programming 3 October 23rd 03 08:11 PM


All times are GMT +1. The time now is 10:38 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"