What are the specific names for these OLE controls?
- by Kris
I have been working on making a block of code that would enable me to input values into a worksheet, as well as an MSgraph object. I have succeeded in this, but this has just presented me with a new set of problems:
What are the control names for changing the visible size as well as the focus of a worksheet?
What are the control names for changing/making background colours and borders?
How do I create and define new worksheets and MSGraph objects inside the document?
My example code so far:
Option Explicit
Dim objWord 'Word application object
Dim objIShape 'Inline shapes object
Dim objOLE 'OLE object
Set objWord=CreateObject("Word.Application")
objWord.Application.Documents.Open("C:\birdy.doc")
objWord.Visible=True
Set objIShape = objWord.ActiveDocument.InlineShapes
Function count_filled_spaces(intOLENo, strRange)
'Activates the the inline shape by number(intOLENo) and defines it as the OLE object
objIShape(intOLENo).OLEFormat.Activate
Set objOLE = objIShape(intOLENo).OLEFormat.Object
'Detects the ClassType of the inline shape and uses a class specific counter to count which datafields have data
Dim strClass, i, p, intSheetno
intSheetno = 1
strClass = objIShape(intOLENo).OLEFormat.ClassType
i = 0
If Left(strClass, 8) = "MSGraph." then
For Each p In objOLE.Application.DataSheet.Range(strRange)
If p <> "" Then
i = i+1
End If
Next
ElseIf Left(strClass, 6) = "Excel." then
For Each p In objOLE.Worksheets(intSheetno).Range(strRange)
If p <> "" Then
i = i+1
End If
Next
objOLE.Worksheets(intSheetno).Range("B" & i+1) = objOLE.Worksheets(intSheetno).Range("B" & i)
End if
count_filled_spaces = i
End Function
Dim strRange
strRange = InputBox("Lol", "do eeet", "B1:B10")
wscript.echo count_filled_spaces(2, strRange)
'objWord.Application.Documents.Save
'objWord.Application.Documents.Close
'objWord.Application.Quit
WScript.Quit(0)