DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute a "real" VBS command in DIAdem script?

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

0 Kudos
Message 1 of 4
(4,604 Views)

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?  
0 Kudos
Message 2 of 4
(4,594 Views)

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

 

 

 

 

0 Kudos
Message 3 of 4
(4,591 Views)

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?  
0 Kudos
Message 4 of 4
(4,582 Views)