05-25-2009 03:31 AM
Hello,
I've some troubles to execute specific "real" VBS command lines in DIAdem script:
e.g.:
Workbooks.OpenText filname, DataType:=xlDelimited, tab:=True, DecimalSeparator:=",", ThousandsSeparator:="."
Using other writings as
Workbooks.OpenText(filname, DataType:=xlDelimited, tab:=True, DecimalSeparator:=",", ThousandsSeparator:=".")Workbooks.OpenText filname, "DataType:=xlDelimited", "tab:=True", "DecimalSeparator:=','", "ThousandsSeparator:='.'"
don't help, I always get error messages. It seams, that DIAdem has problems with recognition of := .
How can I include such kind of VBS command line in a DIAdem script without getting problems?
Sven
05-25-2009 06:36 AM
Hello Sven!
Named parameters are a feature of VB and not supported in VBS (in general, nothing DIAdem specific).
You have to pass all parameters to the OpenText method in the order defind by MS:
OpenText(FileName, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, TextVisualLayout, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers, Local)
You can keep parameters empty, except the last one.
Matthias
Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |
05-25-2009 07:57 AM
Hi,
thanks for answer, but unfortunately its not over yet.
I tryed the following possibilities:
Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,xlDelimited,,,True,,,,,,,,".",",",,True)
Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,xlDelimited,,,1,,,,,,,,".",",",,1)
Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,"xlDelimited",,,True,,,,,,,,".",",",,True)
Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,"xlDelimited",,,1,,,,,,,,".",",",,1)
Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,1,,,True,,,,,,,,".",",",,True)
Set create_tabfile = Excel.Workbooks.OpenText(Filename,,,1,,,1,,,,,,,,".",",",,1)
but always I get some error messages. I assume, that there is just a format error in the command line, may you help me out with some hints, how to do it right?
Regards
Sven
05-25-2009 10:54 AM
Hello Sven!
Sorry, I just copied the MS documentation. It seems to be that they have added two parameters in a newer version. This will work in all versions (i hope):
OpenText(FileName, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, TextVisualLayout, DecimalSeparator, ThousandsSeparator)
Example:
Call Excel.Workbooks.OpenText(Filename,,,xlDelimited,,,True,,,,,,,,".",",")
OpenText returns a boolean and no Object! You have to use ActiveWorkbook to get access.
Matthias
Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |