LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default running macro step by step different from normal run??

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
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
Creating a Drop Down List with Step by Step Instructions for 2007 remarkable Excel Worksheet Functions 2 March 22nd 09 04:36 AM
Need step by step to add invoice numbering to excel template rmt New Users to Excel 4 July 6th 08 11:45 PM
Macro Step by Step fak119 Excel Discussion (Misc queries) 2 August 31st 06 08:11 AM
What is the step-by-step procedure for making a data list? Bobgolfs56 Excel Discussion (Misc queries) 1 April 23rd 05 02:19 PM
I need step by step instructions to create a macro for 10 imbedde. diana Excel Worksheet Functions 3 January 31st 05 01:56 AM


All times are GMT +1. The time now is 03:16 AM.

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

About Us

"It's about Microsoft Excel"