Category: visual studio officetools
Bitfox on Tue, 23 May 2017 14:14:45
I have found the way how I can edit an OLE Excel but not how I can insert a new one.
Deepak Saradkumar Panchal on Wed, 24 May 2017 06:25:24
you can refer code below to add OLE Object with VSTO.
Private Sub ThisAddIn_Startup() Handles Me.Startup Dim wdApp As New wd.Application Dim wdDoc As wd.Document = wdApp.Documents.Add() wdApp.Visible = True Dim ClassType As Object = "Excel.Sheet.1" Dim FileName As Object = "C:\Users\v-padee\Desktop\Book4.xlsx" Dim LinkToFile As Object = False wdDoc.InlineShapes.AddOLEObject(ClassType, FileName, LinkToFile) End Sub
you can modify the code as per your requirement.
Bitfox on Wed, 24 May 2017 18:03:49
thank you very much for for answer. Mine wile I also found the InlineShape AddOLEObject - but I not able till now to insert this object with x Rows and Y columns. My bee you have for this also an hint?
Deepak Saradkumar Panchal on Thu, 25 May 2017 09:26:03
I try to search regarding setting the rows and columns.
but I did not get anything useful in this direction.
also InlineShapes.AddOLEObject method does not provide any option for it.
you can try to set height and width of shape but I think it will not fulfill your requirement.
other work around is to activate the ole object in editing mode and then manually resize it with mouse.
Bitfox on Thu, 25 May 2017 11:44:30
thx for your answer.
Is it also not possible to access the worksheet proprieties of the InlineShapes. If it possible I can use the Columns("E:W").EntireColumn.Hidden = True.
Thanks in advance,