If you mean a Header on each page;
When you call the function CreateSheet in table 370, the second parameter ReportHeader can be used.
Look for "XlWrkSht.PageSetup.LeftHeader" in the code of table 370.
actually, I am doing the same thing to my client now. what I am doing is using an excel template. In navision, refer to account schedule, there is create workbook and update workbook.
1. I create an excel template
2. in the excel, I use "print title" function in excel to include the line need to print every page
3. in table 370, I create a new function called, updatesheet. And, I copy from the createsheet function.
4. I remove autofit
5. update the excel buffer to the worksheet.
my suggestion: when defining the excel template, print and check the result with testing data before you import the data from excel buffer.
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$27"
.PrintTitleColumns = ""
I recorded a macro in Excel and modified the page-setup. Then I looked at the code that Visual Basic recorded.
If this is not the answer to your question, you can record your own macro in Excel and do the things you want to do and take a look at the VBA-code.
Next you have to use this code in NAV.
Thank you very much for your info. With this, it was really easy to make the change in NAV 4.0.
I've done it like that (maybe it helps anyone else....)
Table 370 (Excel Buffer), Function "CreateSheet"
Add new Parameter for this Function "SetPrintTitleLineNo" as Integer
Add the Code to Function
...
XlWrkSht.PageSetup.RightHeader :=
STRSUBSTNO(Text006,GetExcelReference(2),GetExcelReference(3),CRLF,UserID2);
XlWrkSht.PageSetup.Orientation := XlLandscape;
// New Code Set PrintTitel 0 = No Print Title > 0 = Line for Print Title
IF SetPrintTitleLineNo <> 0 THEN BEGIN
XlWrkSht.PageSetup.PrintTitleRows := '$' + FORMAT(SetPrintTitleLineNo) + ':$1';
XlWrkSht.PageSetup.PrintTitleColumns := '';
END;
// New Code END
...
best regards to all NAV experts and comming up experts!! \:D/
Comments
When you call the function CreateSheet in table 370, the second parameter ReportHeader can be used.
Look for "XlWrkSht.PageSetup.LeftHeader" in the code of table 370.
Tino Ruijs
Microsoft Dynamics NAV specialist
1. I create an excel template
2. in the excel, I use "print title" function in excel to include the line need to print every page
3. in table 370, I create a new function called, updatesheet. And, I copy from the createsheet function.
4. I remove autofit
5. update the excel buffer to the worksheet.
my suggestion: when defining the excel template, print and check the result with testing data before you import the data from excel buffer.
Can I set a "Print Title" for a line without using an Excel Template?
Thanks again
cure
Thankyou again!! :P
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$27"
.PrintTitleColumns = ""
I recorded a macro in Excel and modified the page-setup. Then I looked at the code that Visual Basic recorded.
If this is not the answer to your question, you can record your own macro in Excel and do the things you want to do and take a look at the VBA-code.
Next you have to use this code in NAV.
Tino Ruijs
Microsoft Dynamics NAV specialist
Thank you very much for your info. With this, it was really easy to make the change in NAV 4.0.
I've done it like that (maybe it helps anyone else....)
Table 370 (Excel Buffer), Function "CreateSheet"
Add new Parameter for this Function "SetPrintTitleLineNo" as Integer
Add the Code to Function
best regards to all NAV experts and comming up experts!! \:D/
cure
I'm going to bookmark this topic.
By the way: I don't think you have to use XlWrkSht.PageSetup.PrintTitleColumns := '';
Tino Ruijs
Microsoft Dynamics NAV specialist
But now my customer has a new wish. Can I format a Cell to the Right (called Rechtsbünding in German).
And can I hide the Grid by NAV Code?
have a nice weekend
bye, curdin
Never tried it, but I guess when you record a macro and take a look at the vba-code, you could use this code in NAV. Like with the titles.
Tino Ruijs
Microsoft Dynamics NAV specialist
So I tried the same in NAV
FormatRight is a new Boolean Field in T370!
Unfortunately Excel has not so much fun with this line. The Error is
The call to ember HorizontalAlignment failed!
Then in German: Die HorizontalAlignment Eigenschaft des Range Objektes kann nicht festgelegt werden!
OK, I now, that my NAV Code is really ugly. Maybe someone knows it better?