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

VSTO Clickonce – error when upgrade

$
0
0

I published a new version of VSTO clickonce.

When the user opens the file on his computer, instead of the application upgrading automatically, he gets the following error:

System.Deployment.Application.DeploymentDownloadException: Downloadingfile:///<path of vsto file> did not succeed.”

Name:

From: file:///C:/Documents and Settings/xxxx/Desktop/xxx.vsto

************** Exception Text **************

System.Deployment.Application.DeploymentDownloadException: Downloading file:///C:/Documents and Settings/xxxx/Desktop/xxx.vsto did not succeed. ---> System.Net.WebException: Could not find file 'C:\Documents and Settings\xxx\Desktop\xxxx.vsto'. ---> System.Net.WebException: Could not find file 'C:\Documents and Settings\xxxx\Desktop\Xxxx.vsto'. ---> System.IO.FileNotFoundException: Could not find file 'C:\Documents and Settings\xxxx\Desktop\Xxxx.vsto'.

  at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

  at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)

  at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)

  at System.Net.FileWebStream..ctor(FileWebRequest request, String path, FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean async)

  at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)

  --- End of inner exception stack trace ---

  at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri, FileAccess access, Boolean asyncHint)

  at System.Net.FileWebRequest.GetResponseCallback(Object state)

  --- End of inner exception stack trace ---

  at System.Net.FileWebRequest.EndGetResponse(IAsyncResult asyncResult)

  at System.Net.FileWebRequest.GetResponse()

  at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)

  --- End of inner exception stack trace ---

  at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(TimeSpan timeout)

  at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()


how to stop a popup for install customization excel plugin

$
0
0

Hi,

A while ago I made a c# test project in visual studio 2012 to create an excel add-in. (to test whether or not it worked with open office. I didn't have MS office back than yet.).

It didn't work (what a surprise), so I deleted the project.

Later on I uninstalled Open Office and  installed MS Office 2013. But every time I open Excel, I get this popup message:

After installing visual 2013, I not only get the message above, but I get it twice. 

How can I drop the add-in without having the code?
(hitting "don't install" doesn't work. It will popup next time I open excel)
Kind regards,

Matthijs

Loop to search for array text then copy/paste

$
0
0

I have a Word document containing a result report of a weekly athletics meeting. There a several results grouped together for each of a range of events.

Here is a brief extract...

Men 18-19 Discus Throw 1kg F36:

 1. Shaun Markham, HCTU, 10.26m.

Women 15-17 Discus Throw 1kg:

 1. Elizabeth  Jones, TAIR, 36.34m; 2. Courtney Martin, ODR, 32.61m; 3.

 Jessie Scurr, ODR, 26.24m.

Women 15-17 Hammer Throw 3.00kg:

 1. Elizabeth  Jones, TAIR, 49.04m; 2. Courtney Martin, ODR, 42.34m; 3.

 Melina Palmer, TAIR, 29.24m.

Men 14&U High Jump :

 1. Benjamin Smith, ODR, 1.65m.

Men 18-19 High Jump :

 1. Brent Cheshire, ODR, 1.80m.

The vba macro I have written is

Selection.HomeKey Unit:=wdStory
     With Selection.Find
    .ClearFormatting
    .Text = "discus"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = False
    .Execute
    Selection.Extend
    Selection.Copy
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.EndKey Unit:=wdLine
    Selection.TypeParagraph
    Selection.PasteAndFormat (wdFormatOriginalFormatting)
    Selection.Extend
    Selection.Extend
    Selection.Extend
    Selection.Range.Bold = True
    Selection.Font.Grow
  End With
End Sub

...finds the first occurence of a result for discus and creates a bold heading on a new line immediately above that first result.

What I want to do is repeat this process for the block of results for each event...ie create a heading for Hammer, High Jump etc, etc.

I could just repeat this code for every event (there could be up to 30 or 40 possible events but in any given week there will only be perhaps 15...so not every event will feature in a results report)  but there must be a loop or such like that could cycle through each event listed in (perhaps) an array.

This would keep the macro compact and would mean that if an event name changes the only modification required to the macro would be in the array.

Can someone help me?

Send status Report of Outlook _TaskItem

$
0
0

Hello,

I am using Microsoft.Office.Interop.Outlook and I want to Send status Report at given Email Id , my code is like below,but I doesn't send any report to receipt.Please reply

 outlookObj = new Microsoft.Office.Interop.Outlook.Application();
                    fldTasks = (MAPIFolder)outlookObj.Session.GetDefaultFolder(OlDefaultFolders.olFolderTasks);

 foreach (_TaskItem item in fldTasks.Items)
                    {
                       item.StatusOnCompletionRecipients = "abc@abc.com;";
                       item.StatusUpdateRecipients = "abc@abc.com;"
                       item.StatusReport();
                       
                            break;
                        }
                    }

Date Time error in Excel

$
0
0

I made a Excel VSTO report, which queries a DataTable(with ADO.Net) from database(Oracle),then write the result DataTable to Excel, one of the column is Date-Time, the original oracle type is 

"timestamp", most of this progress is working fine, but one of the Data-Time value is just not right.

1. the original oracle db value is "02-11-13 23.59.59.673000000", type of timestamp, means 2nd-Nov-2013 23:59:59.
2. after query, the value in the result DataTable is "02/11/13 23.59.59 PM", it's right.
3. then transform this DataTable to a two dimension Object Array,the value in the Object Array is "#02/11/13 23.59.59 PM#", type of {Date}, it seems right.
4. use some "targetRange = tmpArray" like code, write this Object Array to Excel, after that, the value in Excel became "2013-11-02 00:00:00", about 24 hours earler.
5. only this "02-11-13 23.59.59.673000000" value has this problem, all the other timestamps are right.


Starting Excel using Excel.Application

$
0
0

we have a console application that opens either Excel/Word (if not already open.) 

The code to open word/excel is as shown below. (The purpose of this program is to open Excel/Word if not already open. So it does not call Quit. It opens Excel/Word and terminates. Our VSTO Addin that loads when Excel/Word is started does some processing and it is user's responsibility to close the Excel/Word.)

private static void StartWord()
        {
            // WORD IS STILL OPEN AFTER THIS CONSOLE PROGRAM TERMINATES
            Word.Application wd = new Word.Application();
            wd.Visible = true;
            Marshal.FinalReleaseComObject(wd);
            wd = null;
        }

        private static void StartExcel1()
        {
            // EXCEL OPENS BUT IS IMMEDIATELY CLOSED AS SOON AS THIS CONSOLE PROGRAM TERMINATES
            // I CAN SEE EXCEL START AND TERMINATE IN TASK MANAGER
            Excel.Application xl = new Excel.Application();
            xl.Visible = true;
            Marshal.FinalReleaseComObject(xl);
            xl = null;
        }

        private static void StartExcel2()
        {
            // EXCEL OPENS AND REMAINS OPEN AFTER THIS CONSOLE PROGRAM TERMINATES.
            Excel.Application xl = new Excel.Application();
            xl.Visible = true;
            xl.Workbooks.Add();
            Marshal.FinalReleaseComObject(xl);
            xl = null;
        }

        static void Main(string[] args)
        {
            //StartWord();
            StartExcel1(); // NOT WORKING. EXCEL IS CLOSED AS SOON AS THIS PROGRAM TERMINATES
            //StartExcel2();
        }

The function to start word is StartWord() and it works as it is shown in the above code.

But the corresponding function to start Excel StartExcel1() does not work. It starts Excel but as soon the console application closes Excel is also terminated.

If I use StartExcel2() which additionally opens an empty workbook, then Excel remains open and visible even after the console application.  

My question is is something wrong in the way Excel is started in StartExcel1 function.

Thank You,

Rakesh

How to find the cells range under a Shape in Excel

$
0
0

Hello everyone,

I'm trying to programmatically paste an image next to an existing image in an Excel sheet.

The problem is that I don't know what cell should I select before I actually paste.

I was expecting that the Shape object has a Range property that represents the cells that the Shape "sits" upon, but there isn't something like that as far as I found.

Anyone knowshow to do it?

Thanks,

Jason


Jason Orphanidis

Insert a textbox in Word 2010

$
0
0

Hello,

I have been developing Word 2010 plugins using VS2010. So far inserting content controls and shapes, tables has been good but this time I'm really stuck. I know this might be easy but I need some guidance. I want to Add a Textbox (shape) on Word 2010 document. I'll be adding content controls to it to hide/show later. But to get the initial textbox added seems a hurdle.

Thanks a lot in advance for the help!

Regards,

May


Office 2013 crashes when trying to debug Addins from Visual Studio 2013

$
0
0

Hi,

I'm a Microsoft partner & Action Pack subscriber from Germany. I've installed Office Prof. Plus 2013 and Visual Studio Prof. 2013 on my new Surface Pro 2 (8 GB, 256 GB SSD; Windows 8.1 obviously ;). When I try to start any Outlook or Word Addins - even"empty" ones created from the provided templates - from Visual Studio either one of the following happens:

  • No window is displayed but Outlook is visible in Taskmanager as a background process (me logged in with domain user with administrative rights; domain controller is a Microsoft Small Business Server 2011)
  • Outlook window is visible but doesn't respond to interaction (local user with administrative rights)
  • Outlook starts but wants to disable addin because it "crashed" Outlook. If I enable it the Outlook process is terminated.

When I start Outlook outside of Visual Studio and enable the addin it's working without problems; actually it took me just a few minutes to write a dialer plugin that dials Outlook contact numbers on my Grandstream IP phone but HOURS trying to solve the debugging problem.
Attaching the debugger to the Outlook process either "hangs" Outlook or terminates it.

Using a local admin user didn't help; neither did repair installations of Office 2013 and Visual Studio 2013. I didn't find any relevant info in the logs or in the VS output window. I started VS 2013 and Outlook as Administrator, googled, binged ... ;)

I wonder what I could do with VS 2013 and Office 2013 if I could actually debug my applications! ;) BTW - Windows Phone 8 development and ASP.NET MVC 5 projects are running without problems.

Any help would be appreciated very much!

Best regards,

Harald Mühlhoff

CARECOM(R) Dipl.-Inform. Harald Mühlhoff
www.harald-muehlhoff.de


CustomDocumentProperties not saving with document

$
0
0
All,

Let me explain my scenario. I have a system that I need to attach Office documents into. To do so, I need to add a CustomDocumentProperty that contains an ID I can key off of later. When a user uploads a document for the first time, I need to create the property, attach it, save the document, close the document, read it into a stream and send to the webservice and reopen the document for them.

Before saving the document, I run the following function
        private void SetDocumentControlId(Microsoft.Office.Interop.Word.Document Doc, string documentId)
        {
            var props = (DocumentProperties)Doc.CustomDocumentProperties;
            var cc = (from DocumentProperty prop in props
                      where prop.Name == DOCUMENTID
                      select prop).FirstOrDefault();
            if (cc != null)
                props[(object)CCDOCUMENTID].Delete();

            props.Add(DOCUMENTID, false, MsoDocProperties.msoPropertyTypeString, documentId, Type.Missing);

        }
DOCUMENTID is a simple string constant. Doc is the activeDocument.

I believe (unless I've misread it), that if the property exists, you have to delete it in order to change its value, so that's the middle part of the code.

After exiting from the function, I can inspect the current document. The property exists and is accessible. I call Doc.Save(), close the document, upload it, then reopen.

The property is not there.  I *have* managed to see it work, but not consistently and it's never based on changes to that block of code.

Can anyone point me to why those properties may not be persisting?

Thanks,
R

Trying to use Visual Studio for a shortcut in Excel

$
0
0

Hello, I’m trying to write a program in excel that would make my job at work much easier. Every month I’m tasked with taking new Credits/Debits from a source, going through all of our previous excel sheets, updating the new dollar amounts, and adding in any new companies and their dollar amounts, and then making sure the dollar amounts for both spreadsheets match up. So heres what I want to do, Search name for Company and and its subsequent dollar amount (in excel). Next, search through excel sheets for that company name and its subsequent dollar amount, if numbers are same leave alone, if numbers are different, update the new balance. Any new company names will either be added at the end of the excel sheet or a note will pop up notifying me of a new company name. Whats the best way to go about starting this?

automation html to .doc

$
0
0

Hello

 

Were using VSTO to automate the generation of .doc or wordML files, we do this by letting word parse an html string and saving the result. This works but using office(2003) in such a way is discouraged by MS. So I need a way to automate the generation of a word doc without using word. I tried aspose (www.aspose.com) and seemed to be what we need but there html to .doc conversion has one mayor flaw, thy don’t support style sheets they only support “inline styles”.

 

Any advice on other products that might be able to do what I want?

Does office 2007 have improvements concerning automation, which may make it more usable for this purpose?

 

SmartTags cause Excel to become unresponsive

$
0
0

Windows 7 and Office 2007

I have a VSTO addin which currently only has the follow code;

Private Sub ThisAddIn_Startup() Handles Me.Startup

        Dim smartTagFile As Microsoft.Office.Tools.Excel.SmartTag = Globals.Factory.CreateSmartTag("MYApp#MYApp_File_Smart_Tag", "MYApp File")

        smartTagFile.Expressions.Add(New Regex("(?<![A-Z\d])(?:(?:19|20)?\d\d[A-Z]\d{5}((\s\s?(?!WO|WE|EP)[A-Z]{2}(?![A-Z]{2})|(?:WO|WE|EP)[A-Z]{2}|(?:WO|WE|EP|[A-Z]{2}))(0[1-9]|1[0-5])?)?|(?:19|20)\d{7})(?!\d)"))


        IpasAkzAction = Globals.Factory.CreateAction("File Lookup.")

        smartTagFile.Actions = New Microsoft.Office.Tools.Excel.Action() {IpasAkzAction}

        'Check that smart tags are turned on
        'If Me.Application.SmartTagRecognizers.Recognize = False Then
        '    Me.Application.SmartTagRecognizers.Recognize = True
        'End If

        Me.VstoSmartTags.Add(smartTagFile)

    End Sub

If I open two excel files with a large say 1000 to 1500 rows then upon opening the second file Excel hangs and nothing can be done.  I have to go to Task Manager to end it.



Microsoft.Office.Core.FileDialog.Execute() method throw ComException on non English Locale

$
0
0

The following code works fine when I used English locale for the current user. But dialog.Execute() throw the exception when I changed to non English locale for the current user. Any ideas?

 

The code:

Microsoft.Office.Core.

FileDialog dialog = this.Application.get_FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogSaveAs);

int result = dialog.Show();

if (result != 0)

{

dialog.Execute(); 

}

 

The exception:

System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at Microsoft.VisualStudio.Tools.Applications.AddInAdapter.Microsoft.VisualStudio.Tools.Applications.Contract.IEntryPointContract2.ExecuteEntryPoints()
   at Microsoft.VisualStudio.Tools.Office.Internal.AddInHostAdapter.ExecuteEntryPoints()
   at Microsoft.VisualStudio.Tools.Office.Runtime.EntryPointView.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.ExecuteEntryPoints()

 


Thanks,

Henry

want to identify WPF object through Excel Macro

$
0
0

Would really appreciate if anyone can suggest a detail description how to identify WPF object through Excel VBA/Excel Macro. I got wpf in Excel reference but don't know how to use it in order to dentify WPF object.

Thanks for your help in advance!

Regards,

Debprasad


Protect worksheet takes eternity

$
0
0
Is it normal that protecting a worksheet in Excel via VB.NET takes eternity? I would say it is at least five seconds per sheet (multiply that by 60 and you're close to how long it takes to protect everything in my workbook). Can I make that any faster?

Outlook Message Item From Template - with Book Marks

$
0
0

Hello Everyone,

I'm doing a real horrible search or I'm not searching or the write thing here. I have an outlook template file with bookmarks that I need to edit.

My ultimate goal is to create an outlook item from a template,

Modify a few fields in the template. Three bookmarks there and I can't seem to access them.

Could anyone help.

I have the references to outlook and Word in my application but I'm not finding the book marks. I don't have code because none of the code I write accesses the bookmarks.

I tried to use the Outlook inspector but no luck there.

What processes does Microsoft do in Outlook 2013 when an add-in first loads

$
0
0
I am combating the dreaded Outlook 2013 issue where add-in must start up in 1 second or less. Other my code,what processes does Microsoft do when an add-in first loads in Outlook that counts towards to the 1 seconds limit and how can I profile what is called during start up time?

Addin develop:EnvDTE.Project.get_Properties() ComException

$
0
0

Hello everyone, I have a problem about addin develop as follows:

Problem:

    My request:In my addin, I need add my own menu to website project , and the language should be C#/VB.

    Method:  I do this in QueryStaus function. If parameter [commandName] is my own menu, then get current select project is website, then get the project language. Like follows:

     Array prjs = (System.Array)_applicationObject.ActiveSolutionProjects;
     if (prjs.Length == 1 )
    {
       Project prj_selected = (Project)prjs.GetValue(0);
       if (project.Object is VSWebSite)

       {
            VSWebSite objWebSite = (VSWebSite)project.Object;
            Property webSiteLang = project.Properties.Item("CurrentWebsiteLanguage");
                   
             if (webSiteLang.Value.ToString().Equals("Visual C#") || webSiteLang.Value.ToString().Equals("Visual Basic"))
            .....   

        }

      }

This is work well except in VS2010/2012, there is error as follows:

       System.Runtime.InteropServices.COMException (0x80029C4A): タイプ ライブラリ/DLL の読み込みエラーです。 (HRESULT からの例外: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))   場所 EnvDTE.Project.get_Properties()

NOTE:

    OS:Win7

    VS:there are VS2005/2008/2010/2012 installed

Any one can help me?

Outlook add-in start events in Office 2013

$
0
0

I have the dreaded problem in Outlook 2013 where Outlook is complaining that my VSTO add-in is taking too long to start up(between 1.8 to 3.4 seconds). I want to find what particular methods are hogging up too much time. My events/methods called during start up run in a combined time of less than half a second (so optimizing this is good but I will still have the problem). This was calculated by having timers at the start and end of my event handler that handles the addin startup event outlook provides. So, it must be something behind the scenes from Microsoft. However, I could not find ALL such methods involved in Start up (just some in the autogenerated file that comes with Outlook project and they run quickly too).

What Microsoft event/methods are called when an Outlook add-in starts up?




Viewing all 5157 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>