Hi Marcel,
just tested the script in Word 2007 ( yes, that with ... unusual interface :) ) and all seems to work as it should.
Good work !
Petr
Printable View
Hi Marcel,
just tested the script in Word 2007 ( yes, that with ... unusual interface :) ) and all seems to work as it should.
Good work !
Petr
Hi Marcel,
I'm sorry for my typo (slipt instead of split)!
I tested your script and now it work but I don't understand why SplitSpecial returns 0.
If I made the call directly (I mean from the module) the results is the same, but strangely enough in both cases the function seems performed correctly.
You can test it with:
[code=thinbasic]
msgbox 0, COM_Succeeded(COM_Execute(pWdView, "SplitSpecial", %TB_DISPATCH_PROPERTYGET, 0, 0, vRetVal))
[/code]
However, I'm working on setting an indexed property.
Bye,
Roberto
Hi Roberto,
Thanks for the testcode. I have the same problem as you with the SlitSpecial code. As I mentioned above the code I used was a recording done by Word. I created a macro to open the header. In the code the splitspecial property came along. But in all circumstances in Word it is always 0.
I made another test and now I got another value for the SplitSpecial property when I first put the Word screen in the primary footer state.
[code=vb]Sub header()
'VBA code below
'
ActiveDocument.ActiveWindow.View.SplitSpecial = wdPanePrimaryFooter 'This command opens a special footer window
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.TypeText Text:="test"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub[/code]
About the indexing problem, I got it wotking with the .Item property.
Hi Marcel,
as far as I understand SplitSpecial property should gets or sets the active window pane, so may be in our case the active window pane is 0, so we should first try to set as active the window pane nr.1 but I must finish to accommodate the function.
Did you mean set the .Item property or get or both?Quote:
About the indexing problem, I got it wotking with the .Item property
Ciao,
Roberto
Hi Roberto,
About the SplitSpecial issue you are right. With all the information I gathered uptil now and tests I made, it was after all simple. The reason that the code wasn't invoked was due to fact that the SplitSpecial and wdPaneNone were still the same.
[code=vb]If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If[/code]
When a user is working in Word the user can get the screen in a certain state, see the SplitSpecial types above in the answer for Abraxas. However, I could not get Word in this state only with VBA code, see next example vba code.
[code=vb]'VBA Code
ActiveDocument.ActiveWindow.View.SplitSpecial = wdPanePrimaryFooter 'This command opens a special footer window[/code]
So this is a simple property setting and it works when I assign one of the wd-constants. In fact the problem is solved now.
About the adddressing of the index. I tested a lot with different constructions and the next one works when I use the Item property in VBA. It is possible to use the short way of adressing:
[code=vb]ActiveWindow.Panes(2).Close[/code]
and the extended way with the Item property.
[code=vb]temp = ActiveWindow.Panes.Item(2)
temp.close[/code]
and resulted in the next thinbasic code:
[code=thinbasic]
'thinBasic code
'Now the addressing starts!
vParam(1) = 2
COM_Execute(pWdPanes, "Item", %TB_DISPATCH_METHOD, 1, vParam, vRetVal) 'This works
'vRetVal holds the indexed pane value.
pWdPane = vRetVal
COM_Execute(pWdPane, "Close", %TB_DISPATCH_METHOD, 0, 0, 0)
[/code]
So in the end we can call just one object from a colection of objects. In this case it is a Pane but if there are more than one documents active we can get one particular document and make it active and work with it. The problem was which thinbasic syntax I had to use to 'connect' the object model. But you must tell me if what I made is correct, I have no knowledge about it, I just combining syntaxes and see what happens. ;D
Now it can. That means also that constructions with [code=vb]for each obj in objects[/code] must be rewritten into loop constructions. :)
------ Added -------------
To answer your question: Did you mean set the .Item property or get or both? >>>> BOTH
Hi,
How can I prevent those &#160;&#160 characters in the code boxes when I edit the text after I've posted it? >:(
Not sure what they are,
try to "modify message", delete them and place there spaces (?)
Bye,
Petr
Marcel
maybe you used the small edit icon on the right, try to use the Modify message link on the top of post.
Ciao,
Roberto
Sometimes I've noted too that color codes in colored syntax.
Usually it is enough to re-edit the message and save again to see them disappear.
Seems a problem of the syntax color engine. Sometimes it get confused by some code
@Petr: Yes replacing them works fine. I have done this all the time but now I want to prevent this.  ;)
@Roberto: Yes, I used the little edit Icon. I'll try the modify message link.  :)
--- Ok, that works better.