Code: Select all
obj = CreateObject(Outlook.Application")
Code: Select all
obj = New Outlook.Application
Code: Select all
Dim obj = As New Outlook.Application
Code: Select all
obj = GetObject(, "Outlook.Application")
Any thoughts?
Code: Select all
obj = CreateObject(Outlook.Application")
Code: Select all
obj = New Outlook.Application
Code: Select all
Dim obj = As New Outlook.Application
Code: Select all
obj = GetObject(, "Outlook.Application")
Code: Select all
Sub Main
Const olFolderInbox = 6
Dim oFactory, oApp, oSess, oFolder
oFactory = createUnoService("com.sun.star.bridge.oleautomation.Factory")
oApp = oFactory.createInstance("Outlook.Application")
oSess = oApp.GetNamespace("MAPI")
oFolder = oSess.GetDefaultFolder(olFolderInbox)
Print oFolder.Name
End Sub
Code: Select all
If (x is nothing) Then
My wife really wants the baby out, but it is not due until March11.TerryE wrote:Hope that the family is giving you a lot of enjoyment.
Code: Select all
Sub Main
Dim aasDesc() as String
Dim aasIP() as Any
call ExecuteQuery(asDesc, aasIP)
s = "IPConfig: " & Chr(10)
for k=LBound(asDesc) to UBound(asDesc)
sDesc = asDesc(k)
s = s & sDesc & Chr(10)
asIP = aasIP(k)
for j=LBound(asIP) to UBound(asIP)
s = s & " " & j & ": " & asIP(j) & Chr(10)
next j
next k
msgbox s
End Sub
sub ExecuteQuery(DescrArray as Any, IPAddArray as Any)
oleService = createUnoService("com.sun.star.bridge.OleObjectFactory")
VBScript= oleService.createInstance("MSScriptControl.ScriptControl")
VBScript.Language = "VBScript"
s = ""
s = s + "Public DescrArray()" + Chr(10)
s = s + "Public IPAddArray()" + Chr(10)
s = s + "Set oWMIService = GetObject(""winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2"")" + Chr(10)
s = s + "Set IPConfigSet = oWMIService.ExecQuery(""Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE"")" + Chr(10)
s = s + "ReDim DescrArray(IPConfigSet.Count-1)" + Chr(10)
s = s + "ReDim IPAddArray(IPConfigSet.Count-1)" + Chr(10)
s = s + "k = 0" + Chr(10)
s = s + "For Each IPConfig in IPConfigSet" + Chr(10)
s = s + " DescrArray(k) = IPConfig.Description" + Chr(10)
s = s + " IPAddArray(k) = IPConfig.IPAddress" + Chr(10)
s = s + " k = k + 1" + Chr(10)
s = s + " Next" + Chr(10)
VBScript.ExecuteStatement(s)
DescrArray = VBScript.CodeObject.DescrArray
IPAddArray = VBScript.CodeObject.IPAddArray
End sub
Code: Select all
Option Explicit
Option Compatible
Sub X()
Dim a As ScriptControl, oMod, i, myZ
Set a = New ScriptControl
a.Language = "VBscript"
oMod = a.Modules.Add("Mod1")
oMod.AddCode ( _
"Public x, y, z" & vbCr & _
"Sub Fred (a): x = 2*a : End Sub")
oMod.AddCode ("Function sqrIt(a): sqrIt = a*a : End Function")
oMod.AddCode ("Sub save(a,b): z = array (a,b) : End Sub")
For i = 1 To oMod.Procedures.Count
Print oMod.Procedures.Item(i).Name
Next i
Print oMod.Run("sqrIt", 12.4)
oMod.Run("Fred", 10.4)
Print oMod.CodeObject.x
oMod.ExecuteStatement "Call Fred(23): y = 123 + x + sqrIt(3)"
Print oMod.CodeObject.y
oMod.Run("save","Hello","there")
myZ = oMod.CodeObject.z
Print myZ(1)
End Sub