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: 4,391
Default Same action but different codes recorded.

Edmund,
Running this code (a) on XL2000 I would expect a compile, so your actual
error may be due to something else.
But if you are working with different versions of Excel, you should use code
that is compatible with oldest version.
You can see that XL2003 has extra arguments in the .OpenText method, e.g.
TrailingMinusNumbers:=True that XL2000 can't deal with.
As it optional, if it is missing when run on XL2003, the default is used and
XL2000 has no problem.

I don't have XL2003, but the value of Origin= -536 looks rather strange, as
the options for XL2000 are 1, 2 or 3.

NickHK

"Edmund" wrote in message
...
When I pass my Excel file to co-worker & they execute the macro, code

failed
with pop up "Compile Error In Hidden Module : Module1".

To verify, I performed the same action in others PC & recorded macro along
the actions. The below differences were discovered. What have I done

wrong?
(VBA Rookie)

(a) Macro recorded with my laptop using Excel 2003:
ChDir "C:\Highway"
Workbooks.OpenText Filename:="C:\Highway\B2EDIT.txt.out",

Origin:=-536, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote,

_
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False,
Comma:=False _
, Space:=False, Other:=True, OtherChar:="|",
FieldInfo:=Array(Array(1, 4 _
), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6,

1),
Array(7, 1), Array(8, 1), _
Array(9, 1), Array(10, 1), Array(11, 1)),

TrailingMinusNumbers:=True

(b) Macro recorded with OTHER PC using Excel 2000 & also Excel 2003 (which
is same with mine):
ChDir "C:\Highway"
Workbooks.OpenText Filename:="C:\Highway\B2EDIT.txt.out",
Origin:=xlWindows _
, StartRow:=1, DataType:=xlDelimited,

TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False,
Comma:=False _
, Space:=False, Other:=True, OtherChar:="|",
FieldInfo:=Array(Array(1, 4 _
), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6,

1),
Array(7, 1), Array(8, 1), _
Array(9, 1), Array(10, 1), Array(11, 1))

--
Edmund
(Using Excel 2000, XP, 2003)



 
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
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
Recorded macro Gaurav[_3_] Excel Discussion (Misc queries) 4 September 22nd 08 06:46 PM
Recorded macro won't run rjamison Excel Programming 0 June 14th 05 12:14 AM
Recorded macro won't run RobinTaylor Excel Programming 8 April 20th 05 06:38 PM


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