Merging cells in Excel using Excel Buffer

Archy
Member Posts: 70
Hi all!
I have made a report, using Excel Buffer. But I need to merge cells in report header row. It seems, that is impossible to merge cells using excel buffer.
I found in previous topics one way to do it:
xlSheet.Range('A1:C1').Merge;
The only way I can imagine is to complitely modify my report and do not use Excel Buffer table. But it is so complicated!
May be someone could advise some other way? :oops:
I have made a report, using Excel Buffer. But I need to merge cells in report header row. It seems, that is impossible to merge cells using excel buffer.

xlSheet.Range('A1:C1').Merge;
The only way I can imagine is to complitely modify my report and do not use Excel Buffer table. But it is so complicated!

0
Comments
-
You should add new function to Excel Buffer table and call it after CreateSheet. This function will contain xlRange.Merge command0
-
I have added such a function - it works! \:D/
But there is one problem - it merges cells, but do not center content in this new big cell. :-k Any ideas?0 -
You need to set correct property for that cell... try to record the macro and look into it.0
-
Hello,
Can anyone help on merging of Cell, I am trying to call a new function which has a command xlRange.Merge('A1:A2') (calling this after function CreateSheet
for Export to excel). but I am getting following Automation error
Microsoft Dynamics NAV
This message is for C/AL programmers:
This Automation variable has not been instantiated.
You can instantiate it by either creating or assigning it.
OK
and if I try to Initialize it then it show some other error
Microsoft Dynamics NAV
This message is for C/AL programmers:
An exception was raised in method Merge. The OLE control or Automation server has returned error (HRESULT) -2147352567.
The component did not provide the exception description.
OK
is anyone have correct syntex of it then pls let me know. Your co opration shall be appriciated highly.
Thanks0 -
I'm using this code and it works perfectly :
XlBook := XlApp.Workbooks.Open(FileName); //Transfering Data to Microsoft Excel: XlSheet:= XlApp.ActiveSheet; XlSheet.Range('A1:A2').Cells.Merge; XlSheet.Range('A1').HorizontalAlignment := -4108;
I hope it can helps!!!Regards
Hanen TALBI0 -
Hanen,
Thank you so much! Your code works perfectlyBest regards,
Johanna0 -
Dear Hanen,
Please help. How to set the variables. Please define in detail.
Thanks & Regards,
Sushil Chaudhari0 -
It's possible,I remember I did long for one of the Project.
The caption part they wanted to Merge. I guess I used some Automation Variables.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions