I'm writing an MS Access class module to export data into OpenOffice calc. Can someone give me a pointer please for how to merge cells in VBA. I've been searching for a code example and I can't find anything.
The OO Developers Guide talks about using com.sun.star.util.XMergeable but I cannot find anything which shows me how to use it.
Thanks
[Solved] Merging cells in VBA
[Solved] Merging cells in VBA
Last edited by RoryOF on Mon Dec 10, 2012 7:28 pm, edited 2 times in total.
Reason: Added green tick
Reason: Added green tick
OpenOffice 3.4 on Windows XP
Re: Merging cells in VBA
In OOBasic it could be done like this:
Code: Select all
oSheets = ThisComponent.Sheets 'This line would need to be different in VBA since ThisComponent is specific to OOBasic
oSheet1 = oSheets.getByName("Sheet1")
oCells = oSheet1.getCellrangeByname("A3:C3")
oCells.merge(True)
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Merging cells in VBA
I was looking for something too complicated. I already had a range object instantiated. So all I had to do was the .Merge True
It works a treat. Thanks for your help.
It works a treat. Thanks for your help.
OpenOffice 3.4 on Windows XP