Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello everyone,
I have created this macro which opens all textfiles (one by one) in a directory, and makes changes to the worksheet (mostly lay-out). When testing the macro step by step (using F8) or using the 'play-button' from VB-editor, the code (see below) converts the document in the correct way. The original code was created using the macrorecorder. However when I execute the macro, using a toolbarbutton, the data is NOT imported in the right way. Can anybody shine some light on this matter. What am I doing wrong. We're working with Office97 on a citrix platform. Many Thanks Do While myFile < "" 'Open document Set myBook = Workbooks.Open(pathToUse & myFile) Workbooks.OpenText Filename:=pathToUse & myFile, Origin:=xlMSDOS _ , StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array( _ 6, 1), Array(37, 1), Array(47, 1)) 'Document Omzetten Omzetten 'Nieuwe naam geven (XLS) Length = Len(myFile) NwLength = Length - 4 NwFile = Left(myFile, NwLength) 'Print en Sluit het gewijzigde document na de wijzigingen ActiveWorkbook.PrintOut Copies:=2 ActiveWorkbook.SaveAs Filename:=(PathToSave & NwFile & ".xls"), FileFormat:=xlWorkbookNormal ActiveWorkbook.Close 'Volgende document in de map myFile = Dir$() Loop Exit Sub Errorhandler: MsgBox ("er is een fout opgetreden, het programma kan niet worden voortgezet. Bel 212 of ga naar huis!") End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating a Drop Down List with Step by Step Instructions for 2007 | Excel Worksheet Functions | |||
Need step by step to add invoice numbering to excel template | New Users to Excel | |||
Macro Step by Step | Excel Discussion (Misc queries) | |||
What is the step-by-step procedure for making a data list? | Excel Discussion (Misc queries) | |||
I need step by step instructions to create a macro for 10 imbedde. | Excel Worksheet Functions |