473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

MsScriptControl.Run error

Hi,

I have a VBScript that I want to run from my VB.NET application.
I initialize everything like this:

AxScriptControl1.Language = "VBScript"
AxScriptControl1.Reset()
AxScriptControl1.AddCode(strText)
AxScriptControl1.AddObject("Toolbar", AxToolbar1)

AxToolbar1 is a component, and strText has the whole script (see later).

When I try to run a fucntion in my script as following:
"AxScriptControl1.Run("OnMailSuccess", Nothing)" I get this error:
"Invalid pointer at MSScriptControl.IScriptControl.Run(String
ProcedureName, Object[]& Parameters)
at AxMSScriptControl.AxScriptControl.Run(String procedureName, Object[]&
parameters)"

When I try like this:
"Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim obj As New Object
obj = ""
AxScriptControl1.Run("OnMailSuccess", obj)
End Sub
"
I got this error:
"Specified cast is not valid. at
VocalcomCetelem.frmAgent.Button1_Click(Object sender, EventArgs e)"

I guess it's something about the error?

I'll give you the whoel scritp too in case it would help.

Thansk a lot in advance,

Pieter

strText = "Dim golApp
Dim objInspector

Sub OnLoad

Set golApp = CreateObject("Outlook.Application.8") 'New
Outlook.Application
End Sub
Sub OnWrapupEnd
on error resume next
Application.Navigate ""
if not objInspector is nothing then
objInspector.Close(1)
end if
on error goto 0
End Sub

Sub OnMailSuccess
Dim gnspNameSpace
Dim gmfInbox
Dim gmiItem

Set gnspNameSpace = golApp.GetNamespace("MAPI")

for j=1 to gnspNameSpace.Folders.Count
if instr(1,gnspNameSpace.Folders.Item(j).Name,"Fax")> 0 then

set gmfInbox = gnspNameSpace.Folders.Item(j).Folders.Item(4)
For i = 1 To gmfInbox.Items.Count

Set gmiItem = gmfInbox.Items.Item(i)
If gmiItem.EntryID = Toolbar.CallInformation(1).ItemID Then
Set objInspector = gmiItem.GetInspector
objInspector.Display
Exit For
End If
Next

end if
next

End Sub"
Nov 20 '05 #1
0 2915

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andrew Powell | last post by:
Hello all. Newcommer to the newsgroups so please let me know if Im not adhering to any policy. Ive setup an app (.NET app) which is using the MSScriptControl. I have the ActivePython package...
0
by: Alejandra Parra | last post by:
I have the next code: Dim Script As Object = CreateObject("MSScriptControl.ScriptControl") I've run this application in WinXP and it works normally, but if I run the application in Win98, the...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
0
by: Slava | last post by:
Hi All, Is it possible to retrieve IActiveScriptSite interface from MSScriptControl using C#? I need this for implementation Exit function ( IActiveScript::Close ). Jscript running inside win...
1
by: Jozsef Bekes | last post by:
Hi All, I need to offer scripting possibilities in my app, and have to use MSSCriptControl for some reasons. I would like to use the feature that's called variable number of arguments, that is...
1
by: Michael Kremser | last post by:
Hi NG! I have converted a running VS.net 2003 solution to VS.net 2005 Beta 2 (Version 8.0.50215.44) and tried to compile it. This is the code: myScriptingEngine = new...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.