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

WPF Non-modal window stops menu shortcuts working initially

$
0
0

Hello,

I am creating a simple WPF non modal window using mywin.Show on top of Excel.  It works fine.

The focus is on Excel, so arrow keys move the active cell etc.  However, Alt-H (say) will not open the Home ribbon.  If I click on Home, then that works.  Further, if I go back to the cells in the spreadsheet the Alt short cuts will now work, despite the non-modal window being displayed, unless I actually click on the non-modal window.

I tried setting mywin.Focusable to false, did not make any difference.

Happens for Excel 2007..2013.  .Net is called from VBA using ExcelDna but I doubt if that has anything to do with it.

Any ideas about what to try much appreciated.  I suspect something nasty in the ribbon implementation.

Regards,

Anthony


Anthony


access data on combobox from another sheet

$
0
0

Hello:

I have sheet 1 and sheet 2. In Sheet 1 I have a cell that contains certain values, those values are the same as the values found on combobox1 on sheet 2. I want to have a button on sheet 1 that when clicked, it sends the value to combobox1 in sheet 2.

I have not been able to figure out how to access comboboxes and list boxes from a different sheet.

commandbar button click event in outlook?

$
0
0

im placing two commandbar buttons under a commandbarpopup and i have separate click events for both commandbar buttons menuCommand1 and menuCommand2 and click events are menuCommand1_Click and menuCommand2_Click......but when im clicking menuCommand1 both the events menuCommand1_Click and menuCommand2_Click are fired and same with menuCommand2 click event

private Office.CommandBarButton menuCommand1;
 private office.CommandBarButton menuCommand2;
 private string menuTag = "A unique tag";


  private void AddMenuBar()
 {
   try
   {
    Office.CommandBarPopup cmdBarControl = null;
    Office.CommandBar menubar = (Office.CommandBar)Application.CommandBars.ActiveMenuBar;
    int controlCount = menubar.Controls.Count;
    string menuCaption = "&New Menu";

    // Add the menu.
    cmdBarControl = (Office.CommandBarPopup)menubar.Controls.Add(
        Office.MsoControlType.msoControlPopup, missing, missing, controlCount, true);

    if (cmdBarControl != null)
    {
        cmdBarControl.Caption = menuCaption;

        // Add the menu command.
        menuCommand1 = (Office.CommandBarButton)cmdBarControl.Controls.Add(
            Office.MsoControlType.msoControlButton, missing, missing, missing, true);

        menuCommand1.Caption = "&MyInbox";
        menuCommand1.Tag = "NewMenuCommand";
        menuCommand1.FaceId = 65;

        menuCommand1.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(
            menuCommand1_Click);


        menuCommand2 = (Office.CommandBarButton)cmdBarControl.Controls.Add(
            Office.MsoControlType.msoControlButton, missing, missing, missing, true);

        menuCommand2.Caption = "&MySchedule";
        menuCommand2.Tag = "NewMenuCommand";
        menuCommand2.FaceId = 65;

        menuCommand2.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(
            menuCommand2_Click);


    }
}
catch (Exception e)
{
    MessageBox.Show(e.Message);
}
}


private void menuCommand1_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool  CancelDefault)
{

}


private void menuCommand2_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
{

}

Separating Outlook 2010 Form Regions in a Separate Assembly in VSTO 2010

$
0
0

I have a VS2010 outlook add in project, where in I am using Outlook 2010 and I am using the imported form regions to extend outlook 2010 functionality.

As per our new requirement, I have been trying to separate, the Form Regions (ofs, .cs, .resx, designer.cs) files, in a separate assembly.

I am planning to invoke the form regions from the outlook addin project which is the main calling project. I have tried this, without success and need some help, as it is much more obscure than I thought.

Despite googling on web I have not found out a single resource, that speaks of such kind of a thing. Yet, I have not given up, because I have tweaked the designer code and got it working some how; till the point that, it does not invoke the custom Form region (.ofs) for Appointment item. Instead, it is not able to find the ofs and is loading the default appointment item. However, I am successfully able to build the assembly with Form Regions.

To clarify further, I have performed the following steps:

[1] Excluded the imported FormRegion(s) {.ofs, .cs, .designer.cs, .resx files} from the main Add In project.

[2] Added a new class library project to the existing solution.

[3] Addded all the necessary references needed by the Outlook Add In project to the assembly project.

[4] Added .ofs, .cs, .designer.cs, .resx files of the Form Regions to the Assembly project and got to build it successfully.

[5] Add the assembly project reference to the main AddIn project

[6] Removed the partial implementation of WindowFormRegionCollection (containing a single property) from the Form Regions designer code and implemented it in ThisAddIn.designer.cs with the Fully qualified class name as return type of the property.

[7] Comment out the Factory property and _factory field from the Globals class in ThisAddIn.designer.cs and moved it to a separate Globals class (in Global.cs) in the assembly project.

After doing these changes, I was able to get the ribbon invoke my Form Region, which is an extension of Appointment Item. However, instead of my Form Region (ofs), the default appointment item is invoked. The error here happens in GetCustomUI method and other subsequent calls as well. I am not sure, how to get this thing working. Please guide me further.

Any slightest help, in the form of articles, samples, code snippets, posts, etc. is much appreciated.

Thanks,

Bhushan


Software Consultant

dynamiclly enable disable VSTO ribbon in a powerPoint

$
0
0

I have developed a VSTO ribbon to work with PowerPoint and this ribbon only appears when I open PowerPoint via another windows application. If user open PowerPoint alone, I have hide the ribbon (I’m using name pipe mechanism to communicate PowerPoint and my windows application). Even this work fine, sometimes I have to kill the PowerPoint process to apply this function (scenario : I open PowerPoint with application so the ribbon appears . then I close both PP and windows application and re open power point alone .Then still the ribbon appears. Then I go to task manger and kill the power point then. Then ribbon is hide)

I have written the call “client part” of name pipe communicator on “Ribbon_Load” of VSTO. How do I solve this issue?

 

How to add a menu of Checkboxes in a custom Ribbon control?

$
0
0

Using VSTO 2010 for MS Word 2007, I tried the following. The menu shows up with the items Item1 and Item2 but chekbox does not show up. I want a checkbox to show up to the left of each item:

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2010/01/customui" onLoad="OnLoad">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns">
        <group id="MyGroup"  label="My Group">

            <menu id="mnuID" label="Menu Label" itemSize="Normal">
                 <checkBox id="ID1" label="Item1" visible="true" />
                 <checkBox id="ID2" label="Item2" visible="true" />
             </menu>

      </tab>
    </tabs>
  </ribbon>
</customUI>

Please help. Thanks..Nam

How to handle the "click" or "next slide" event of a Powerpoint remote

$
0
0
I'm building an application in Visual Studio 2008 (.Net 3.5) that works in a similar fashion to a Powerpoint presentation.  And, like many presenters using Powerpoint, the users will have remotes and I need to be able to capture the click event from the remote to advance the slide.  Can anyone give me a little guidance on how I go about capturing this event?

Powerpoint Visual Basic Cooding

$
0
0
Hey! I decided to make a powerpoint OS and make something like a command prompt. The thing I'm asking is how do you add text on a label that allready has text but on a new line? Example: whenever you type in a command something pops up, and if you type in another command it pops up on a new line without clearing the screen. 

Context menu in the Calendar module in the Outlook

$
0
0
hi

i wanted to add a custom menu item in RMB (right mouse button) context menu in the calendar module in the Outlook as shown here.

it will be really helpfull if someone provide me with sample code.

im using vs2008, c#.

/kevin


Vsto Word 2007 addin deployment issues

$
0
0
Hi group,
I'm having a strange issue with a Word 2007 addin deployment. Here's the scenario:

- the addin has been created with VS 2008 SP1 for Word 2007, and uses dotnet 3.5 SP1.

- to deploy the addin I right click on its project, choose Publish and publish it for cd-rom. I also ensure that before publishing the Update option is set to none (cd).

Once deployed I copy the setup files into a test Vista Ultimate machine and install it. Everything works fine, and the addin starts with Word 2007. Then after some days of regular usage, without any apparent reason when I start Word the addin no more appears, and the only way I've found to make it appear again is reinstalling. Could anyone give a hint about that?

Thanks!

VSTO Addin Excel 2013 Impossible to copy two charts

$
0
0

Hello everyone, 

I am having troubles copying two charts in excel 2013.

Here is my code :

chart1.ChartArea.Select()
app.ActiveChart.ChartArea.Copy()
app.ActiveSheet.Paste()
chart2.ChartArea.Select()
app.ActiveChart.ChartArea.Copy()
app.ActiveSheet.Paste()

When copying two different charts, I get the following COMException : "Paste method of Worksheet class failed", after executing the last Past() method. The strange thing is it doesn't always fail : in my test, it works 5% of the time.  Stranger, the first past() will fail the same way if I am debugging the code with visual studio.

I first developed my addin for excel 2007 and it works fine. Then a bug appeared when testing on 2013 and I discovered this strange behaviour was the cause of it.

Am I doing something wrong or is it a excel 2013 issue?

Thank you for your time and help.



Show / hide a ribbon depending on active workbook

$
0
0

How do I show / hide a VSTO add-in Ribbon depending on what workbook is active? So I have an add-in that a user needs only when certain xlsx-file is activated and when not, I want to hide the add-in (at least the ribbon part of it).

If I can select, I'd like the answer in VB.Net, but I can manage with C# too.

row count and column count of excel file in C#

$
0
0

How can I get the row count and column count of an excel file I opened using C#? I want to iterate through the cells with background color but I have no idea when to stop the loop. I already have a variable for the active worksheet then I have no idea what to do to get the row count and column count of the worksheet...

 

Thanks!

using threads in Word VSTO Solution

$
0
0

Hello developers, I am writing a Word-AddIn in VB.NET. The application is to gather registration information from our SQL database and produce a series of reports; registration confirmation, assistance, etc. On a regular day there might be around 50-150+ registrants prior to the event and I have created a Word Template to produce a confirmation report. The process works great but user can actually see the work being done and cannot use word until job is completed.

I want to do it on the background using a background worker but cannot make go. Anyone has a sample? need to open a new instance or Word, open up the template, connect to database-query data and produce report, once its done make instance visible. I had it working on Word 2007 but does not work on 2010.

S.O.S.

Thank you in advance and God bless..

Word crashes when my vsto add-in runs

$
0
0

When my addin runs, Word crashes... this popped up:

"emet detected heap spray mitigation... closing winword.exe"

my addin build in vs2010 and vsto 2010.


Document-Level Add-In does not load when started from Template

$
0
0

Hi!

I created a customized Word 2010 Template (document level add-in, .NET 4), which gets deployed to the program files folder. My customer is experiencing on one of his machines the weird behavior that the add-in does not load if he opens the template. However, if a document (docx) created from the template (on another computer) is opened on that machine, the add-in loads without problems.

 

I created another customized Word 2010 Template, which only shows a Hello World message box on document startup. My customer experiences the same issue that the add-in does not get loaded. So I created yet another document-level add-in, however this time a Word 2010 Document, which also shows a Hello World message. This add-in runs without any problems.

 Both test add-in have been deployed to a local folder and the template/document was opened from that folder. In both cases, a security warning occurred whether the add-in should be trusted or not and in both cases Install has been clicked.

 

So far I have only found very few hints for reasons why a document-level add-in in a customized Word Template does not get loaded, in particularhttp://msdn.microsoft.com/en-us/library/ms178759(v=vs.100).aspx, however the stated conditions do not apply.

I get the following VSTO error message (log output of VSTO logging) without any details for both, my real add-in as well as the test add-in (Word Template):

 

Log entry added at 12:14:23:

-----------Caption----------------

Microsoft Office Document Customization

-----------Message----------------

The customization assembly could not be found or could not be loaded.

You can still edit and save the document. Contact your administrator or the author of this document for further assistance.

-----------Details----------------

(null)

The machine runs Windows XP SP3 32-Bit with Office 2010. The add-ins are built targeting Any CPU.

What are the reasons for a loading failure of a document-level add-in if the add-in gets started from a Word Template instead of a Word Document?

Windows installation (created from VS 2010) failed while installing VSTO 4.0 Runtime.

$
0
0

Hi,

My current project is using VS 2010 .NET Framework 4.0 and Office 2010.

We need to silent install if VSTO not in users machine.

I'm using Windows Installer for installing our custom VSTO excel application and it was working fine for before VSTO link was changed.

But it is failing to install it, since VSTO location has been changed.

Can some one look into this, as we need to install VSTO on client machine while installing our application.

Thanks in advance.

Error is as below:

Result of checks for command 'VSTOR40\vstor40_x64.exe' is 'Install'
'Microsoft Visual Studio 2010 Tools for Office Runtime (x86 and x64)' RunCheck result: Install Needed
EULA for components 'Microsoft Visual Studio 2010 Tools for Office Runtime (x86 and x64)' was accepted.
Copying files to temporary directory "C:\Users\NISHAN~1.MOG\AppData\Local\Temp\VSDAEFF.tmp\"
Downloading files to "C:\Users\NISHAN~1.MOG\AppData\Local\Temp\VSDAEFF.tmp\"
(8/29/2013 2:34:34 PM) Downloading 'VSTOR40\vstor40_x64.exe' from 'http://go.microsoft.com/fwlink/?LinkId=158918' to 'C:\Users\NISHAN~1.MOG\AppData\Local\Temp\VSDAEFF.tmp\'
Download completed at 8/29/2013 2:34:56 PM
Downloading failed with HRESULT=-2146697211


Thanks

Utshek Jain


how to add ribbon to add in

$
0
0

Hi all,

I'm very new to vb.net and visual studio as well. I'm using visual studio 2012 premium edition and I'm trying to develop an add in for Visio 2013. I've customized a ribbon with a button on it. I've also created a user control. I want the user to click the button on the ribbon and have the user control pop up. The problem is, I can't even figure out how to add the ribbon code into the visio add in code. I've done hours and hours of research, went and bought a book, and I feel like this task is supposed to be so easy, no one clearly specifies how it's supposed to be done. Can anyone point me in the right direction?

Regards

Implementing multi-tab browser powerpoint plugin in c#, disappears on second visit

$
0
0

I am trying to implement a multitab webbrowser plugin in powerpoint using c#.

So far, i am using shdocvw.webbrowser objets over multitab and set the visibility of them to true or false based on the corresponding tab. It works alright.

The problem starts when I want to view the multitab slide for the second time while slideshow. By some untold reason, my webbrowser objects disappear except for the first one! I tried to set the zorder or visibilty but none of them worked! Interestingly, the browsing seems to be done since the tab title changes as the web page title does!

My Code is like this:

PowerPoint.Shape tabStrip = sld.Shapes["tabs"];PowerPoint.Shape webShape1 = sld.Shapes.AddOLEObject(left, top +60, width, height *(float)0.85-60,"Shell.Explorer.2");PowerPoint.Shape webShape2 = sld.Shapes.AddOLEObject(left, top +60, width, height *(float)0.85-60,"Shell.Explorer.2");PowerPoint.Shape webShape3 = sld.Shapes.AddOLEObject(left, top +60, width, height *(float)0.85-60,"Shell.Explorer.2");PowerPoint.Shape webShape4 = sld.Shapes.AddOLEObject(left, top +60, width, height *(float)0.85-60,"Shell.Explorer.2");PowerPoint.Shape webShape5 = sld.Shapes.AddOLEObject(left, top +60, width, height *(float)0.85-60,"Shell.Explorer.2");

                tabStrip.ZOrder(Office.MsoZOrderCmd.msoSendToBack);

                webShape1.Name="web1";
                webShape2.Name="web2";
                webShape3.Name="web3";
                webShape4.Name="web4";
                webShape5.Name="web5";SHDocVw.WebBrowser web1 = webShape1.OLEFormat.Object;SHDocVw.WebBrowser web2 = webShape2.OLEFormat.Object;SHDocVw.WebBrowser web3 = webShape3.OLEFormat.Object;SHDocVw.WebBrowser web4 = webShape4.OLEFormat.Object;SHDocVw.WebBrowser web5 = webShape5.OLEFormat.Object;


                webShape1.OLEFormat.Object.Visible=true;
                webShape2.OLEFormat.Object.Visible=false;
                webShape3.OLEFormat.Object.Visible=false;
                webShape4.OLEFormat.Object.Visible=false;
                webShape5.OLEFormat.Object.Visible=false;

            web1.Navigate2(webAdress[currentSlide,0]);

I create 5 shapes containing the webbrowser object every time the slide is visited in SlideShow Mode and delete the webShapes when the user visits the other slides, then make the first one visible and the rest invisible. It works fine at the first run but

Please help me what should I do?

Word 2013 BuildingBlockInsert Event Does Not Fire

$
0
0

I am trying to use this event in a document template built with VS 2012, but the event only fires when the user inserts a building block from the word toolbar, not when they type a building block name and press F3. Is there any way to get the event to fire in all cases? If not, then the event is really quite useless, isn't it?

The event doesn't fire when a building block is inserted programmatically, either, but that is obviously less of a problem. 

Viewing all 5157 articles
Browse latest View live


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