Quantcast
Channel: Visual Studio Tools for Office (VSTO) forum
Viewing all 5157 articles
Browse latest View live

csproj (load Failed)

$
0
0

Hi All,

With VS 2012 on Windows 8 and Office 2010, I'm receiving a failure when opening up my VS Word AddIn Solution stating:

<project>.csproj : error : Specified cast is not valid.

And under the Solution Explore, that project says <project> (load failed)

and when I expand the project, it says:

The project requires user input.  Reload the project for more information.

and when I right click the project in solution explorer and select "Reload Project" it says:

A project with that name is already opened in the solution.

Now I've been running this solution on a Windows 8 machine with Office 2013 for months now (and it still runs just fine).  I just copied it to a second machine to do some debugging on Office 2010 and can't get around this error.  Anyone know what I'm running into??

Thanks ahead of time.

WordRake


Function paste is very slow

$
0
0

I am developing a VSTO COM application that creates a new ribbon in Excel.  One function on the ribbon allows the user to create a new Excel worksheet in the open workbook and create functions that get data from another worksheet in the same workbook. The formulas on the new worksheet are designed to allow the user to copy and paste new values on the original worksheet in a way (using the "INDIRECT" term) that automatically updates those values on the new worksheet.   If there is no value in a cell on the original worksheet, the function pastes the code term "CodeBlank" in the corresponding new worksheet cell.

However, this paste function is extremely slow, about 1 second per function.  Any ideas why?  The "originalSheet" is the original worksheet from which the new worksheet gets data.  The refCell is a cell on the originalSheet.  The newCell is the corresponding cell on the new worksheet to which the data from the refCell is imported.  The originalRange is the range of data on the original originalSheet that will be imported to the new sheet.

Dim newCell as Excel.Range

Dim refCell as Excel.Range

For c = 3 to numCols For r = 3 to numRows newCell = startCell.Offset(r,c-1) refCell = originalRange(r,c) Dim formula as String formula = "IF(isblank(INDIRECT(" & """" & "'" & originalSheet.Name & "'!" & refCell.Address.ToString & """" & "))," & """CodeBlank""" & ",INDIRECT(" & """" & "'" & originalSheet.Name & "'!" & refCell.Address.ToString & """" & "))" newCell.Formula = formula newCell.NumberFormat = targetSheet.Range(refCell.Address.ToString).NumberFormat Next Next


Gina


Gina

Creating .msi installer for MS Word 2010 AddIn - Cannot add Add-In after installation

$
0
0

Hi all

I'm trying to create an .msi installer for my Word 2010 AddIn. First time I was using VSTO deployment but we cannot use an exe file for our company because if we use .exe we cannot install it over active directory. We would have to install it individually on every computer. To avoid this, we want to install it over active directory and with an msi file.

So I created an msi Installer using a video tutorial. This worked fine and if I installed it, it is in my installfolder (addin.dll, a config file and of course the references). But if I now open Word 2010 it isn't there. So I went to "Options > Add-Ins > COM-Add-Ins > Go to...". Then I clicked on "Add" and search for my .dll file to add. But if I want to add the file, I get an error:

"<Path to .dll file>.dll is not a valid Office-Add-In"

I'm really confused about this error and I get stuck on this.

So I hope you can tell me if it's possible to install and add/use a MS Word 2010 AddIn with an msi file. And I also hope you can tell me how I can get rid of this problem.

Thanks,
Roman

very intermittent "The customization assembly could not be found..." error

$
0
0

I have a VSTO Word 2010, VS2010 document level customization project where it typically works fine. 

The issue is that on a few slower machines, Word will occasionally either throw the error "The customization assembly could not be found or could not be loaded.", or just crash when opening a document randomly.  If you try to re-open the document after the crash or error, it opens fine, so there is nothing wrong with the document or the customization. 

The scenario is this:

1. Have a local folder of documents based on the customization - 30-40 of them.

2. Open a file, look at it for review, then close it.  (it does not matter what you do in the document)

3. Open the next file for review as soon as the previous one is closed.

4. Every 10-20 openings you will get either a word crash or the above error.  All files in the folder do open if you go back to it after the error or crash.

One customer sent me a hdmp where it showed Word with a threading issue as the cause of the crash.

It seems like it's possible that Word is trying to accesses the customization .dll before it has been properly released by the last instance of word.  I've tried leaving the documents open and opening 10-20 at a time with no problem.  It appears to be related to closing the only instance of word, and then reopening it with the next file.

Because there is nothing wrong with the customization, and some machines don't show this problem at all, I'm not sure how to address the issue.  The crash and error are upsetting to my customers, even if harmless. 

I would appreciate some advice on where to look for the cause of this issue and/or anything I could change in my customization to avoid the problem. 

Thanks for any help.

Here is some of the crash information - which happens if the above mentioned error does not:

Problem signature:


  Problem Event Name: APPCRASH

Application Name: WINWORD.EXE

  Application Version: 15.0.4454.1000

  Application Timestamp: 509a4ea6

  Fault Module Name: wwlib.dll

Fault Module Version: 15.0.4454.1004

  Fault Module Timestamp: 50bdaab1

  Exception Code: c0000005

  Exception Offset: 00000000001fb326

  OS Version: 6.2.9200.2.0.0.256.4

  Locale ID: 1033

Additional information about the problem:

  LCID: 1033

  skulcid: 1033

And from the event log:

Faulting application name: WINWORD.EXE, version: 15.0.4454.1000, time stamp: 0x509a4ea6

Faulting module name: wwlib.dll, version: 15.0.4454.1004, time stamp: 0x50bdaab1

Exception code: 0xc0000005

Fault offset: 0x00000000001fb326

Faulting process id: 0x83c

Faulting application start time: 0x01ce2cd0d691d5a7

Faulting application path: C:\Program Files\Microsoft Office 15\Root\Office15\WINWORD.EXE

Faulting module path: C:\Program Files\Microsoft Office 15\Root\Office15\wwlib.dll

Report Id: 14f5b9cb-98c4-11e2-be7a-000c29d0272a

Faulting package full name:

Faulting package-relative application ID:

Excel Addin Setup is Adding ribbon but not adding my UDF's...?

$
0
0
I had created and Excel addin using Visula studio 2010 for Escel 2010. I had created its MSI by following MSDn link http://msdn.microsoft.com/en-us/library/ff937654.aspx. 

When I am installing it to a different PC, it adds the ribbon defined by me in my project, but my UDF's are not at all working.

Can't add an image and convert to Shape to position correctly (vsto and Word)

$
0
0

Hi,


Been wrestling this one for a few days and can't seem to find the answer. We have a Picture ContentControl in a Word document and need to do something that seems straightforward. Add a picture to the content control, convert it to a Shape and then set the positioning. Wrote the following code which is fine in the debugger but creates an error at

Microsoft.Office.Interop.Word.Shape floatShape = myShape.ConvertToShape();

Does anyone know why this creates an error of 'Error HRESULT E_FAIL has been returned from a call to a COM component.'

                    ContentControls listCCs = oWordDoc.SelectContentControlsByTag("ccSectorGraphic3");
                    if (listCCs.Count != 0) 
                    {
                        foreach (ContentControl thisCC in listCCs)
                        {
                            if (thisCC.Type == WdContentControlType.wdContentControlPicture && thisCC.Tag == "ccSectorGraphic3")  // looking for the picture content control i want to update  
                            {
                                MessageBox.Show(thisCC.Title + " - " + listCCs.Count.ToString()); 
                                thisCC.Range.Select();

                                // Add our image
                                InlineShape myShape = thisCC.Range.InlineShapes.AddPicture(strFilename, ref oMissing, ref oMissing, thisCC.Range);

                                // We need to convert the picture from an inLine shape to a normal shape!
                                Microsoft.Office.Interop.Word.Shape floatShape = myShape.ConvertToShape();
                                
                                // Now let's position and scale it correctly
                                floatShape.RelativeHorizontalPosition = WdRelativeHorizontalPosition.wdRelativeHorizontalPositionPage;
                                floatShape.Left = oWordApp.CentimetersToPoints(1);
                                floatShape.RelativeVerticalPosition = WdRelativeVerticalPosition.wdRelativeVerticalPositionPage;
                                floatShape.Top =oWordApp.CentimetersToPoints(25);
                                floatShape.WrapFormat.Type = WdWrapType.wdWrapTopBottom;

                            }
                        }
                    }


Change VSTO language only for one method

$
0
0

I have a VSTO add-in for Excel. In this VSTO I have a taskPane with a textbox and a label. The user writes in the textbox a numberformat and in the label an example is presented with the applied numberformat.

In order to update the label I use Application.WorksheetFunctions.Text. However this method returns the number format in English format and not in my system language as Excel does. I would not like to change the hole language of VSTO.

So is there a way to change the language only while I call the Text method?

Ex: Application.WorksheetFunctions.Text(DateTime.ToOADate(),"dddd, MMMM dd, yyyy hh:mm:ss") =>Wednesday, March 14, 2001 13:30:55

while excel gives me => miercuri, martie 14, 2001 13:30:55

SELECT Statement against Excel file?

$
0
0

How can I run sql statement against excel file. I am using office 2003 and want to run retrieve information from a column in excel file.

 

SELECT DISTINCT Code FROM Excel_File_name? Is this possible?

 

Thanks  


VSTO Multiple threads

$
0
0
I am creating a stock trading application in Excel using VB.Net (VSTO).  Let's say I have 10 stocks 'working' at the same time (10 different rows, each row is independent).  When a stock is filled, I want to wait 15 seconds, then send another order.  I need to do this for each row.  So I would like to create 10 countdown clocks, each one starting and ending at different times.  Should I use threading or background workers?  the only purpose is to countdown from 15 to 0...

Issues with Microsoft Add-in removing Java

$
0
0
I recently wrote an add-in for Microsoft Office Outlook and deployed it to a few members as a beta. We noticed that when you installed the add-in it removed Java from the machine. Please help I need both to be able to work at the same time.

Error while adding a new sheet in VS designer in a VSTO Excel project

$
0
0

Hi All,

When I try to add a new sheet in my existing (VSTO Excel, VSTO 4.0 C# application with Office 2010) project from Visual Studio. It add successfully but when I compile it throws the below error:

“Partial declarations of 'NameSpace.Globals' have conflicting accessibility modifiers wsSheet1.Designer.cs”

I’ve read lots of articles about “Partial class and its accessibility modifier”, but not able to find its fix in that Designer.cs.

Due to this I’m not able to proceed with new sheet in the project.

Thanks a lot in advance.

Utshek Jain


Thanks Utshek Jain

Is it possible to disable Word's Save or Print functions?

$
0
0
As part of a larger solution, we want to be able to display a document in Word for the user to approve or deny.  Those options will be displayed via a VSTO Ribbon.  One of our customers is also interested in having an option to disable the Print and Save features of Word while this document is displayed.

I believe it is possible to remove the Print and Save buttons from the Ribbon, but what if the user presses Ctrl+S or Ctrl+P?  Is it possible to disable those functions entirely?

installing pia is start,but nothing happend and closed quickly

$
0
0

when i opened .csproj ,which was checked out from SVN, with notepad, i found the detail of OWC(office web compenot)

    <COMReference Include="OWC11">
      <Guid>{0002E558-0000-0000-C000-000000000046}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>1</VersionMinor>
      <Lcid>0</Lcid>

i don't have that kind of OWC.dll.

 

after all, i found a OWC.dll in my COMReference,

when it was added in project, .csproj file would be like this:

    <COMReference Include="OWC11">
      <Guid>{0002E558-0000-0000-C000-000000000046}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>

then i search in all of the ms webside, i can't find any one like OWC.dll with version 1.1.

i thouht maybe it caused by registry.

could you pls help me for this issue..


Excel chart for multiple segregated column using C#

$
0
0

Hello 

 

I want to create excel chart for multiple columns which are segregated. Following is my code for single range

 

xlRange = xlSheetScript.get_Range(

"B6", "B400");

xlChart.ChartWizard(xlRange, Excel.XlChartType.xlLineStacked, Type.Missing,

Excel.

XlRowCol.xlColumns, Type.Missing, Type.Missing, false,

"Daily", Type.Missing, Type.Missing, Type.Missing);

 

 

I want to include B6:B400, D6Big Smile400 and G6:G400 ranges also in the chart. (only 3 Columns)

 

Please let me know how can i do that.

 

Thanks.

 

Automating Word Mail merge from ASP.NET application

$
0
0
I am search for a solution that requires an intranet application (asp.net)  to launch word 2007 after performing a mail merge operation.  My data is retrieved from an XML webservice and the document that gets merged varies based on the data received.

The end user needs to be able to edit the final merged document on the fly so word 2007 needs to be launched after the merge has taken place.

I have reserached trying to use Word Template projects (we use visual studio 2008), creating word merged documents in vb.net etc even trying to perform a mail merge using java script. Does anyone know of a good clean solution to the above?  There are possibly 300 documents I would need to support so the intranet applicatoin to do the merge seems the best route for this application.  I do not want to use VBA or any menuing systems within Word - this causes too much maintenance.  The end user needs to be able to create templates as well (they would like to manage these in word).

I see the intranet app doing the data retrieval, merging the document template and data then launching work and putting the user in the final document.  They would edit/print the final document at that point.

Please help!  Thanks.  Any refernece material would be welcome.
Al Penfound

Right click context menu problem of word 2010 / 2007.

$
0
0

Hi Everyone,

I am working on one word add-in using c#. I have added my new menu to the right click context menu of word and every thing is going well, but the problem is when I do a right click on the Image or if I select the whole table using + sign and then doing the right click on selection, then my menu is not appearing there. When i did the research, i found that there are lots of context menus available with different options.

Here are the different context menus available for - like Endnotes, Fields, Display Fields, Form Fields, Footnotes, Headings, Lists, Inline Picture, Inline Canvas and many more. If I am trying to include all those, then right click is taking too much time to respond (performance issues) to generate. Is there any code available with the help of which i can create the right click context menu for all contexts (Tables, Text and Images) with good performance.

I am trying to create my right click menu to the context menu using WindowBeforeRightClick event. Does this is creating issues or what is required?

Let me know, if anyone has any questions for that.

Thanks,


Shahab Abbasi

VSTO solution won't run for document stored on OneDrive for Business

$
0
0

Hi,

I have a document-level level VSTO solution installed in Word 2013.  If I copy the .docx file to my OneDrive folder ("C:\users\[username]\OneDrive @ [MyBusinessName]"), I get an error saying "This document contains custom code that cannot be loaded because the location is not in your trusted locations list......."

When I move the file to any other folder on my hard drive, it runs fine.

I have added the OneDrive to Word's Trusted Locations, but that doesn't seem to work.

Any help would be most appreciated.

VSTO for Office 2010 .Net 4.5 solution!?

$
0
0

Hi there!

We're developing an Office 2010 add-in using VSTO.

While trying to create a VS 2012 version, we hit the wall caused by the fact that some assemblies referenced by our project are compiled as .Net 4.5 assemblies. As a consequence, while usingVisual Studio 2012 RTM, we are forced to target .Net 4.5 as well.

And here comes the problem! Although we can upgrade to v4.5 all satellite assemblies, we are unable to upgrade core add-in assembly since VSTO projects for Office 2010 does not support .Net 4.5 as a target framework.

Is there any workaround for this issue?

Or even better - is it possible that the VSTO team produce (un)official .Net 4.5 package?

Kind regards,


Sasa Tomicic
MCPD: Shpt Dev 2010, MCITP: Shpt Admin 2010, MCPD: Win Dev 4
My blog: Share(d)Point of View
Follow me on Twitter: @Sasa_Tomicic

Please remember to click 'Mark as Answer' on the post that helps you or click 'Unmark as Answer' if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


.NET 4.5 Office 2010 add-in

$
0
0

Hi Everyone,

Is it possible for an office 2010 add-in project to target .net 4.5?

Currently  I get this error when trying to change (vs 2012) the project to target .net 4.5 from .net 4.0:

"The .NET Framework version you selected is not supported by this project type."

Is this scenario not officially support by Microsoft?

We are trying to update our entire solution to .net 4.5 and this is the only project not upgrading.

I have seen the various work-arounds such as manually changing the target framework in the project file... I am still looking for an official / supported solution or at least someone from Microsoft stating that this combination of .net 4.5 and Office 2010 add-in is not supported.

Thank You!

VSTO: When will we get .NET 4.5 support?

$
0
0

Hi

I installed the Microsoft Office Developer Tools for VS2012 and now I get Office 2013 templates in VS2012. However, when I create an Excel 2013 add-in project I see it still targets .NET 4.0.  If I try changing the target framework version to 4.5, I get the same error as I do with the Excel 2010 addin project - "Attempted re-targeting of the project has been canceled. The .NET Framework version you selected is not supported by this project type."

This is a problem because I want to use components that have been upgraded to .NET 4.5.

Any idea what is going wrong?

Thanks
Howard


Viewing all 5157 articles
Browse latest View live