li_rc = inv_ole.connecttoobject(as_input)
inv_ole.Application.Windows(1).Visible=TRUE
inv_ole.Application.Windows(1).Activate
inv_ole.Application.Workbooks(1).Worksheets(1).Range(ls_from
+":"+ls_to ).MergeCells = True
inv_ole.Application.Workbooks(1).Worksheets(1).cells(li_start,
1).value
= ls_data
inv_ole.Application.Workbooks(1).Worksheets(1).cells(li_start,
1).Font.Bold = True
inv_ole.Application.Workbooks(1).Worksheets(1).cells(li_start,
1).Font.size = 12
What i want is to switch off the gridlines in worksheet(1).
Can anybody suggest code for this.
Regards,
-Brijesh
I have seen alot of these types of questions lately. People asking for
answers which are relatively easy to figure out. Please do a little
research before asking your question. You may actaully find someting
useful in the process like printing and viewing the gridlines have
totally different methods involved. To get your answer, open the vba
editor in Excel and search the help for "Grid" and look at the
worksheet view object. That is what I did before I wrote this response
since I was curious also. Or you can start macro recording and simply
perform the action in Excel and then look at the recorded macro.
Personally, I prefer doing tne research since more than often the
macro show a method wjich is not neceassrily the best way to ;erform
the desired action.
Wheeley
Thanks for your reply Wheeley. I did the research on this before
posting this. I am not very expert in these so sought group help on
this. What i have found in the help is the below code..
Workbooks("BOOK1.XLS").Worksheets("Sheet1").Activate
ActiveWindow.DisplayGridlines = Not(ActiveWindow.DisplayGridlines)
I have tried below code but didn't help me at all.
inv_ole.Application.Workbooks(1).Worksheets(1).DisplayGridlines= False
i may be using it wrong so need your help with this.
Thanks
-Brijesh
Your problem is you are not understanding how Excel works. And here is
where you need to read more. Windows and worksheets are two different
objects in Excel. I'll give you the code but you need to read further
about windows. Also, if you print the workbook you are creating, you
WILL get gridilines. Here's the code as it should be written. Lots of
changes which you need to research.
myoleobject lnv_workbook, lnv_worksheet
lnv_workbook = Create lnv_workbook
lnv_worksheet = Create lnv_workbook
li_rc = inv_ole.connecttoobject (as_input)
if li_rc = 0 then
lnv_workbook.SetAutomationPointer(inv_ole.Application.Workbooks(1))
lnv_workbook.Windows(1).DisplayGridlines = FALSE
lnv_worksheet.SetAutomationPointer (lnv_workbook.Worksheets(1))
lnv_worksheet.Range(ls_from+":"+ls_to ).MergeCells = True
lnv_worksheet.cells(li_start,1).value = ls_data
lnv_worksheet.cells(li_start,1).Font.Bold = True
lnv_worksheet.cells(li_start,1).Font.size = 12
end if
Destroy lnv_worksheet
Destroy lnv_workbook
hop this helps
Wheely
Thanks a lot Wheely for your help with this. It has worked now.
Regards,
-Brijesh