Hello all,
I made a program that will place data from a table into a merge document and then print it out. When I published it it created a dll. Now I need to use this in another program that sets the information up in the database.
I have placed a reference to the dll in the main program and also copied the dll into my project folder. I then found the following code on the net
Private
Declare Sub Print Lib "ACHSweep" ()You then use the call method to start the processing, supposedly. None of these solutions hgas worked for me, and nothing else I have found addresses this.
Any help is greatly appreciated,
Brian

Using the dll created by publishing my VSTO Word program
b4
OK. Did you deploy/publish the VSTO solution on your development machine When you run it from within the IDE, certain assumptions about security, etc. are made. These don't carry over to just opening the document on the machine, directly. Start here
http://msdn2.microsoft.com/en-us/library/hesc2788.aspx
and here
http://blogs.msdn.com/mshneer/archive/2006/01/05/deployment_articles.aspx
Dan Mikkelsen
Hi tass,
I think I do not completely understand your the problem. For now all I can assume is that you want to use a standalone application to execute some logic you have placed in your customization assembly (If this assumption is wrong, please post more details on the problems you are having).
VSTO generated assemblies are regular .NET assemblies, so in priniple you should be able to use them as any other .NET assembly. Now, all VSTO generated code (ExcelWorkbook, Sheetn, Documentn) is meant to be initialized by the VSTO runtime, so even if as all this generated types are publicly exposed there is no way to initialize them properly from a standalone application. VSTO Runtime can initialize VSTO code only when a customization is loaded from within Word/Excel.
If you have a standalone application, you can start Word and open your customized document through regular automation, but to communicate between your program and your customization you will need to deal with interprocess communication as each one lives on a separate process (.NET Remoting might be a good approach)
GSK_phili
Cindy,
Thanks for the areas to look at. I have a problem once again though. In the blog i went to the Walkthrough, which was the second way of deploying and it states to move over the SetSecurity project into the one that I created. The problem is that I do not have that set of folders in my system. I have tried to search for that project and am unable to locate it. Do you happen to know where it can be found
Thanks,
Brian
Xythe
When you open a customized document in Word / Excel, the Office application automatically starts our runtime that properly loads the customization assembly. You do not need Visual Studio to run the code.
I hope this helps.
Ofir Epstein
Hi tass_fint
Are you testing on your development machine, or another one Does the code run if you press F5 while working with the project in Visual Studio How do you determine the code isn't running Are you sure there are rows in the dataset
MmeBovary
Hi Cindy,
I am testing on my development machine. The code works just fine within the VSTO environment. When I open the document within Word the fields from the dataset do not get filled in. There are 7 test rows in the database.
Sondre - MSFT Regional Director
HI Daniel,
I created the document in Word, then used VSTO to create ThisDocument.vb. This is the code within that file:
Dim ds As New System.Data.DataSet Dim dr As System.Data.DataRow Private Sub ThisDocument_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup Dim count As Integer = 0 Dim cmd As New System.Data.OleDb.OleDbCommand Dim conn As New System.Data.OleDb.OleDbConnection 'TODO: Delete this line of code to remove the default AutoFill for 'DataSet11.achname'. If Me.NeedsFill("DataSet11") Then Me.AchnameTableAdapter1.Fill(Me.DataSet11.achname) End If While count < Me.DataSet11.achname.Rows.Count Me.PrintOut() Me.AchnameBindingSource1.MoveNext()count += 1
End While Me.Close(Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges) End Sub Private Sub ThisDocument_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown End SubYet when I open the document within Word 2003 the Startup portion does not run. Is there something that I am missing
Thanks for all your help,
Brian
Deepthi Rao
Hi Brian,
You can find the SetSecurity project in the attached download that is available in the article
http://msdn.microsoft.com/office/default.aspx pull=/library/en-us/odc_vsto2005_ta/html/OfficeVSTOWindowsInstallerOverview.asp
Regards,
Darryn Lavery [MSFT]
LauraB
Hi Daniel,
You are correct about what I am trying to do. So if I am understanding you correctly, I am not easily able to do what i am trying to do. How would I go about running my VSTO code from within Word as soon as I open up the document It seems like the only way I can get the VSTO code to run is when I start it from within the VS environment.
As always, any help is greatly appreciated.
Brian