The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 using automation server with VBScript

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
silkehl Posted - 02/21/2008 : 05:44:20 AM
Origin Version (Select Help-->About Origin):Origin 8.0
Operating System: Windows XP

Can it be that the function "PutWorksheet" only works properly if the data in a typed array? I want use the function in VBScript and the return value is always false. When I use this function in VB, the result is ok.

Thank you for any help,
Silke
4   L A T E S T    R E P L I E S    (Newest First)
silkehl Posted - 02/25/2008 : 03:24:52 AM
Hi Deanna,

Thank you for your help. It works.

Silke
Deanna Posted - 02/24/2008 : 8:54:31 PM
Hi Silke,

You can try to change the following code:
b = OriginApp.PutWorksheet(ebWksName, data)
into:
b = OriginApp.PutWorksheet(ebWksName, (data) )

The pair of parenthesis forces the data variable to be passed by reference instead of value. I tested on my PC. The data could be passed into Origin.

Deanna
OriginLab Technical Services

Edited by - Deanna on 02/24/2008 8:55:15 PM
silkehl Posted - 02/22/2008 : 02:47:50 AM
Thank you for your answer. I dont know the error. The example is so simple! Createpage and set pagestring work correct, but putworksheet not.
Here my VB code:

Option Explicit
private Const ORIGIN_WINTYPE_WKS = 2
Dim ebWksName,ebSaveFileName
Dim OriginApp

Private Sub ConnectOrigin()
Set OriginApp = GetObject("", "Origin.Application")
OriginApp.Execute ("doc -ss 1")
ebSaveFileName = OriginApp.LTStr("%Y") + OriginApp.LTStr("%G")
end Sub

Private Sub DisconnectOrigin()
OriginApp.IsModified = false
OriginApp.Save (ebSaveFileName)
OriginApp.Execute ("exit;")
Set OriginApp = Nothing
End Sub

Private Sub SendData()
Dim iRowStart,str
Dim d,b
Dim data()

ebWksName = "MyData"
str = "d=exist(" + ebWksName + ")"
If OriginApp.Execute(str) Then
d = OriginApp.LTVar("d")
End If

If d <> 2 Then
ebWksName = OriginApp.CreatePage(ORIGIN_WINTYPE_WKS, ebWksName, "w")
End If
iRowStart = 0

Dim iRow,iCol
ReDim data(5, 5)
For iRow = 0 To 4
For iCol = 1 To 4
data(iRow, iCol) = iRow + iCol
Next
Next

b = OriginApp.PutWorksheet(ebWksName, data)
End Sub

Sub Main()
ConnectOrigin
SendData
DisconnectOrigin
end Sub
Main

Thank you for help.
Best regards
Silke
n/a Posted - 02/21/2008 : 9:14:52 PM
Hi, Silke

The function used in vbscript should be passed the data as reference. Would you mind pasting your code here if this doesn't work?

Cloud

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000