1*cdf0e10cSrcweirAttribute VB_Name = "Module1"
2*cdf0e10cSrcweirOption Explicit
3*cdf0e10cSrcweir
4*cdf0e10cSrcweirSub main()
5*cdf0e10cSrcweir
6*cdf0e10cSrcweirMsgBox "hallo"
7*cdf0e10cSrcweir
8*cdf0e10cSrcweir'The service manager is always the starting point
9*cdf0e10cSrcweir'If there is no office running then an office is started up
10*cdf0e10cSrcweirDim objServiceManager As Object
11*cdf0e10cSrcweirSet objServiceManager = CreateObject("com.sun.star.ServiceManager")
12*cdf0e10cSrcweir
13*cdf0e10cSrcweir'Create the CoreReflection service that is later used to create structs
14*cdf0e10cSrcweirSet objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
15*cdf0e10cSrcweir
16*cdf0e10cSrcweir'Create the Desktop
17*cdf0e10cSrcweirSet objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")
18*cdf0e10cSrcweir
19*cdf0e10cSrcweir'Open a new empty writer document
20*cdf0e10cSrcweir
21*cdf0e10cSrcweirSet objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
22*cdf0e10cSrcweir'get a type description class for Size
23*cdf0e10cSrcweirSet propClass = objCoreReflection.forName("com.sun.star.beans.PropertyValue")
24*cdf0e10cSrcweir
25*cdf0e10cSrcweirDim prop
26*cdf0e10cSrcweirpropClass.CreateObject prop
27*cdf0e10cSrcweirprop.Name = "Hidden"
28*cdf0e10cSrcweirprop.Value = True
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir'create the actual object
31*cdf0e10cSrcweirDim args(0)
32*cdf0e10cSrcweirSet args(0) = prop
33*cdf0e10cSrcweir
34*cdf0e10cSrcweirDim args2()
35*cdf0e10cSrcweir'Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
36*cdf0e10cSrcweirSet objDocument = objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args2)
37*cdf0e10cSrcweir
38*cdf0e10cSrcweirEnd Sub
39