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

Word 2016 :Application.WindowBeforeRightClick is not firing

$
0
0

Hi,

I have created VSTO Add in for word and trying to handle an event Application.WindowBeforeRightClick.

Application.WindowBeforeRightClick is not firing in Word 2016( is working fine in Word 2013)

Can you please suggest how to handle WindowBeforeRightClick for Word 2016 ?


Santosh Sutar


How to query the relational data for Room List and Rooms

$
0
0

hi all,

I've got the code to retrieve me the address entries for "All Groups" and "All Rooms" but i cant quite see the relationship between the dropdown list in the outlook Room finder and the listbox below it showing the rooms for the selected list.

Any help appreciated.

thanks.

VSTO Addin Fails: Excel 2016 and VS 2015 Enterprise

$
0
0

Hello,

This is my first Visual Studio project. 

Interested in consuming a Web Service to return data to MS Excel 2016.

Installed Visual Studio Enterprise Edition 2015 and MS Excel 2016 on a Windows 7, 64 bit PC.

Following process described in Microsoft library document dd819156. (described using with Excel 2007)

I have installed the OfficeToolsForVS2015, version 7.1.504


When I launch Visual Studio, I select File, New, Project.  I then select VTSO Add ins, "Excel 2013 and 2016 VTSO Workbook" Press Ok button twice.
Get the following Error

"Adaptor Addin" is not working correctly. Excel might have disabled the
addin or made it inactive, or all addins might be disabled in your
Trust Center settings. Check the add‐in status in Excel Options. If the
addin is active and enabled, reinstall or repair Visual Studio Tools for
Office."

When I open Excel the Addin is Active

General View and manage Microsoft Office Add-ins.

Formulas
 Proofing Add-ins
 Save Name5 Location Type
 Language Active Application Add-ins
 Team Foundation Add-in "C:\...osoft Shared\Team Foundation Server\14.0\x86\TFSOfficeAdd-in.dll" COM Add-in
 Advanced Visual Studio Tools for Office Design-Time Adaptor for Excel C:\...al Studio 14.0\Visual Studio Tools for Office\x86\VSTOExcelAdaptor.dll COM Add-in


Trust Center settings are also fine. 


I tried reinstalling the VTSO.

Am I doing something wrong?  I do have an older version "2010" of VTSO on my PC, but Excel is not referencing it.


thanks,

walt




Searching attendees and their availability in Outlook Appointment Region

$
0
0

I am working with an Outlook VSTO Region in Appointment window where I am searching and adding attendees from all address books. I couldn't make anything else to work except sequentially searching the GAL for contacts. However I am stuck at the point where I go for a contacts availability as no matter which method I use I get the error 

Cannnot load free/busy information 

so far I have tried:

 Outlook.AddressEntry Outlook.ExchangeUser Outlook.Recipient 

and all of them return the same error. In outlook I can see my contact's availability then why I can't get it programmatically?


VS2008(File > New Project > Others Project Types > Extensibility > Shared Add-in) working on 32 bit Office, but not working on 64 bit Office.

$
0
0

Type: critical issue

 

Environment:

OS : - Windows xp sp2/7

IDE : - Visual Studio 2008

Word: MS Office 2007, MS Office 2010, MS Office 2013

Language : - VB .net

Project type : - File --> New Project --> Others Project Types -->Extensibility --> Shared Add-in

.

 

Problem Description: We have developed Add Ins program for(Word, Excel, Outlook and Power Point)in a integrated installer created by VS 2008 itself which works perfectly on 32 bit Office version.

.

Add Ins Work -   It creates a command button on toolbar, then after we start our customized work.

But as of now, we have received requirement to deliver same component on 64 bit office. We have installed it, but it is not showing any button on word.

.

Kindly assist us, what are the changes, I should make in existing program for making it work on 64 bit Office.

.

I will be really thankful.


Regards, S.P Singh

Outlook VSTO Addin COMException Cannot load free/busy information

$
0
0

In my Outlook VSTO Region I am adding attendees from all address books and looking for their free/busy status, but I always get this error

Outlook.NameSpace mapi =Globals.ThisAddIn.Application.GetNamespace("MAPI");var reci = mapi.CreateRecipient("abc@mydomain.com");string st = reci.FreeBusy(newDateTime(2016,3,10),60,true);

------------------------------------------------------------------------------

System.Runtime.InteropServices.COMException was unhandled by user code
  HResult=-2147352567
  Message=Cannot load free/busy information.
  Source=Microsoft Outlook
  ErrorCode=-2147352567
  StackTrace:
       at Microsoft.Office.Interop.Outlook.Recipient.FreeBusy(DateTime Start, Int32 MinPerChar, Object CompleteFormat)

I have also tried doing it from the AddressEntry object, still the same error. Any help/ suggestions will be appreciated.

How to Disable Shifting Of Cells within namedRange

$
0
0

Hi,

I do have requirement of stopping shifting of cells within our named ranges; as shifting of cells leads to data integrity issue in our application. Whole Objective is either user shall be able to add whole row or delete row but shifting of cells from insert or delete shall not be allowed in specific area of worksheet.

I have tried out alternate approach like Hiding Native Insert/Delete button and pushing our own custom buttons in row & cell context menu. but i am not able to disable shortcut keys like CTRL + & CTRL -.

Any quick help on this will be highly appreciated.

Thanks,

Bhavik Thakkar

How do I detect in an Outlook MailItem if focus is in the Outlook Message body or in the To or CC: fields?

$
0
0

I'm using the code from the answer my previous question here to only hook a keyboard shortcut only if an Outlook mail item is selected.  However, in reality I need to scope it further to only hook the keyboard shortcut IF the focus is in the message body or subject field and NOT if the focus is in the To, Cc, Bcc fields.  I've looked around, but I haven't found any answers.  There must be a way to do this as button are disabled and keyboard short cuts produce different actions in Outlook depending on where the focus is.

//We will handle your issue in these place.
     if (Functions.IsKeyDown(Keys.ControlKey) && keyData == Keys.D1)
     {
      //We will find out whether inspecotrs exist in your outlook.
      if (Globals.ThisAddIn.Application.Inspectors.Count > 0)
      {
       try
       {
        //we will try to get the active inspector.
        Outlook.Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();
        //we will try to find out whether the inspector is for a mail item.
        Outlook.MailItem item = inspector.CurrentItem as Outlook.MailItem;
        //We will find out whether the mail item is a new item. If it is, this inspector is a mail compose inspector
        if (item != null)
        {
         if (item.SenderName == null){
          --> Need to detect which field current has focus in MainItem
          MessageBox.Show("Yes, this is I want!");}
        }
        else
        {
         MessageBox.Show("No, this isn't I want!");
        }
       }
       catch (Exception ex)
       {
        MessageBox.Show(ex.Message);
       }
      }
     }

Retrieve the context menu item on a mail item programmatically from outlook add-in.

$
0
0

I want to get the context menu items on the mail item(outbox of outlook) programmatically from my outlook add-in. I ideally want to programmatically in C# get the context menu item on a mail item and perform invoke operation on the custom context menu item say "MyContextMenuItem". Everything getting context menu on mail item, iterating to find my item and performing the click,  should happen programmatically.  I googled around and found to add context item but not able to retrieve programmatically. Your reply would be of great help.Please Find the attachment for more details.

Thank you..


Viewing Webhelp in a Microsoft Help Viewer

$
0
0
I have generated HTML Webhelp files via an Adobe authoring tool. However, I want the help to display in a single-pane viewer (with search field, home, print, and foward/back arrows displaying at top) similar to the way online help is displayed in Microsoft Office 2013. Does Microsoft have a help viewer that can be coded to call my HTML Webhelp content to display in the single-pane viewer? If so, how can I implement it?

Referring to an Outlook Ribbon item but not from an Add-In

$
0
0

Hi,

I have a VS2010 application that creates and sends an Outlook 2010 e-mail using VSTO however due to some recent changes in regulation we are now required to send all e-mails using a specific secure method.

The organisation that offer the encryption service provides an add-in that adds a button to the Message tab in the ribbon displayed by the mail item inspector however they provide no programmatic interface to be able to automate sending e-mails.  As many of our e-mails are templated and we record when they are sent, it is not practical to simply display the mail item and expect the user to click the button to send it. However I cannot find any way of automating clicking this button or even referring to it as all examples that I can find assume that the code is being executed from an add-in which in this case it isn't.

Can anyone help?  I'm pretty new to VSTO.

System.Windows.Forms.Application' does not contain a definition for 'Session'

$
0
0

Please tell me why "Session" is giving me an error.

using System.Text;
using System.Windows.Forms;
using Outlook = Microsoft.Office.Interop.Outlook;
namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            try
            {
                Outlook.Folder folder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderRssFeeds) as Outlook.Folder;

How to edit Normal.dotm file, and remove only Addins created button(Program Defined) using VB .Net

$
0
0

Type: critical issue

 

Environment:

OS : - Windows xp sp2/7

IDE : - Visual Studio 2008

Word: MS Office 2007, MS Office 2010

Language : - VB .net

Project type : - File --> New Project --> Others Project Types -->Extensibility --> Shared Add-in

 

Problem Description: We have Addins component which runs properly. When we install this component It create a button {SaveDocument}in word.

But when we uninstall the Addins component , It doesn’t  remove "SaveDocument" button.

Atempt: - According to findings, We found that button information store in AppData\Roaming\Microsoft\Templates\Normal.dotm. So, if some how, we can remove button information from Normal.dotm, then It can be removed easily, without deleting other setting in Normal.dotm

Requirement: -

I tried to search on internet for editing and remove that button information from Normal.dotm using vb.net. But, till now, I haven't found any helpful article.

Kindly assist, I will be really thankful.


Regards, S.P Singh


Reply event not fire on new incoming email

$
0
0
items.ItemAdd +=new Outlook.ItemsEvents_ItemAddEventHandler(items_ItemAdd);


 void items_ItemAdd(object Item)
        {
            try
            {
                if (Item is Outlook.MailItem)
                {
                    ((Outlook.ItemEvents_10_Event)(Item)).Reply += MailItem_Reply;

                }
            }
            catch (Exception ex)
            {

            }

        }

I tried to add event to the item, but got the below error
Unable to cast COM object of type 'System.__ComObject' to event interface type 'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3DE4A41F-4A3C-364F-8F83-F3C40C8A06AC}' failed due to the following error: 'No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))' and the COM component does not support the source interface with IID '{0006302B-0000-0000-C000-000000000046}'.

Anyone can help? Thanks.

Event before Slide Advance in PowerPoint Slideshow

$
0
0

Hi,

I have created add-in of PowerPoint where as PowerPoint com lib doesn't expose event that is captured before slide Advances for that I used keyboard mouse global hooking dll where is that is not perfectly working with all versions office some times it crashes.

Does any one have better Idea to capture  event or any other way to stop slide from advances.


Word crashes on InlineShapes.AddPicture(..) - PictureContentControl

$
0
0

Hi,

I have a VSTO Word addin that loops through existing content controls of the active document, identifies the Picture content controls and sets an image file to these. It works generally, but as soon as one of these PictureControlControl elements is placed inside of a text box (for better positioning), Word 2010 crashes when I execute the following code, while Word 2016 works fine.

When a document is opened, which already have set the images in the PictureContentControl, the picture should be re-set (the picture file may change). So I delete existing shapes inside the InlineShapes collection of the content control range.

I use the following code (simplified):

private void ReadPlaceHolderValues(Microsoft.Office.Interop.Word.Document Doc)
{
    // loop through all placeholder elements
    foreach (Microsoft.Office.Interop.Word.Range sr in Doc.StoryRanges)
    {
        foreach (Microsoft.Office.Interop.Word.ContentControl cc in sr.ContentControls)
        {

            if (cc.Type == Word.WdContentControlType.wdContentControlPicture)
            {

                string imagePath = "C:\\temp\\sample.emf";



                // remove existing shapes from range
                foreach (Microsoft.Office.Interop.Word.InlineShape shape in cc.Range.InlineShapes)
                {
                    shape.Delete();
                }

                // add picture
                var imageShape = cc.Range.InlineShapes.AddPicture(imagePath);
            }
        }
    }
}

Am I doing something wrong in my code? Why causes the cc.Range.InlineShapes.AddPicture(imagePath); call Word to crash, if the content control is placed inside a text box? Is it a bug in Word 2010 (because it works in 2016), and is there any workaround?

Best Regards

Andreas

Converting from Microsoft.Office.Interop.Word.WdColor to System.Windows.Media.Color

$
0
0

In my VSTO application, I was struggling to convert from WdColor enum to the Color struct. WdColor uses 24-bit integers but they are not RGB.

As it turns out, WdColor seems to use BGR (the bytes are "backwards").

There are surely better mathematical ways of accomplishing this, but for what it's worth here's my solution:

 

publicclass WdColorColorConverter : IValueConverter
 {publicobject Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  {if (!(value is WdColor))
   {return Colors.Black;
   }elseif ((WdColor)value == WdColor.wdColorAutomatic)
   {return Colors.Black;
   }else
   {int intValue = ((WdColor)value).GetHashCode();string hexValue = intValue.ToString("X").PadLeft(6, '0');string redHex = hexValue.Substring(4, 2);string greenHex = hexValue.Substring(2, 2);string blueHex = hexValue.Substring(0, 2);byte redByte = byte.Parse(redHex, System.Globalization.NumberStyles.AllowHexSpecifier);byte greenByte = byte.Parse(greenHex, System.Globalization.NumberStyles.AllowHexSpecifier);byte blueByte = byte.Parse(blueHex, System.Globalization.NumberStyles.AllowHexSpecifier);

    Color c = Color.FromRgb(redByte, greenByte, blueByte);
    return c;

   }
  }



  publicobject ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  {thrownew NotImplementedException();
  }
 }
It only converts from WdColor enum to Wpf's Color struct but ConvertBack would work the same way in reverse (changing an RGB color to BGR).

WdColor to System Color

$
0
0

Hi

Is there a reliable way to convert word.wdcolor to system.drawing.color in vsto word addin (specially when word.wdcolor returns a negative integer).

Thanks

Kulwinder

Read active range cell that has value using visual studio 2015

$
0
0

Hi All,

I have this excel files like this :

and these,

both files has header, and start on the exact cell. and have same sheet (both was on sheet 1)

it start from A4, and ended on cell C, my question is, how I can merge those 2 excel file, and read cell that have value, example on first excel, it start from A4:C6 and next files was start from A4:C7.

im not using VBA or macro, im using visual studio 2015, with C#. for  these need, im using winform. 

My Goal was create new excel file, such as merge.xlsx, contain the merge result from those 2 files in one sheet.

Im using MS Office Excel 2013.

does anyone can help me?

Thank you.

Best Regards,

Bambang

How to Hold on "Ctrl" key to click button to show gif ( help image)?

$
0
0

i'm sorry that my english is poor  #_#;

I developed a vsto add-in for excel 2010  in VS2010;

now  i want to  know that  How to Hold on "Ctrl" key to click button(menu) to show gif ( help image)?

i don't know how to code? Everyone can help me?

Viewing all 5157 articles
Browse latest View live


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