Jump to content
Xtreme .Net Talk

Cindy Meister

Members
  • Posts

    6
  • Joined

  • Last visited

About Cindy Meister

  • Birthday 02/17/1955

Personal Information

  • .NET Preferred Language
    C#, VB.NET

Cindy Meister's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. It's very hard to offer an opinion, since you don't include any of the VBA code you're using to access the .NET App. Nor do you show in the .NET app how you're exposing the functionality to VBA (COM). But I agree that VBA isn't "seeing" the same class instance your .NET app is using. What should happen to this data (ID, etc.) down the line? Should it be written to a database of some kind? Can't VBA access the stored information (as opposed to the "live" information being held in memory)?
  2. Glad you were able to track it down :-) Good luck with the users <g> -- Cindy
  3. Hi DPrometheus Let's start with the thing I'm absolutely sure about: When you use "IF NOT" you're asking about a boolean, but ActiveDocument is an object, not a value. Try something more like: If Word.ActiveDocument Is Nothing Then That means no object could be assigned to ActiveDocument (it doesn't exist). This should, at least, get rid of the error messages you mention. The only time I would expect to not have an ActiveDocument object is if there are no documents open. A safer way to test this might be If wdApp.Documents.Count < 1 Then Also, at a "professional" level, I'd try very hard to not work with the ActiveDocument object. My inclination would be to keep a collection of some kind of all documents in a particular instance. Monitor the DocumentOpen, NewDocument, DocumentClose and perhaps DocumentChange events so that my code always "knows" which document object (if any) is the current one. That would complicate things considerably, but the approach could help workaround some issues.
  4. Hi DPrometheus Mmm. I'm not sure I'm following all the details of what you're doing, or why you're "switching" templates. You may need to describe that in a bit more detail. As far as debugging goes - you can open a global template (as a document) while it's still working as a global template. Then you should be able to see what line's causing the problem (and I very much recommend NOT using OnError Resume Next as this could run you through multiple errors, so you'd have no idea what the original one might have been).
  5. If you don't want PowerPoint to run at all, then you'd have to read the closed file. For version 2003 (and earlier) that means the old, proprietary binary file formats. The following links are to a forum where these are discussed, and to information on obtaining the specs. - Forum - obtaining For Office 2007 you'd need to use the Office 2007 OpenXML file formats (just in case you'd need to migrate your solution in the future).
  6. Hi DPrometheus I know you've told Mike you've found a way to work around the problem, however, I thought you'd be interested in knowing how to pass a Word document object (or, indeed, any office object) from VBA to your .NET code. You have to declare the parameter in the .NET code as type object. Then you explicitly cast it (in VB.NET use CType()). For example: public void passWordDoc(object doc) { Microsoft.Office.Interop.Word.Document WordDoc = doc as Microsoft.Office.Interop.Word.Document; WordDoc.ActiveWindow.Caption = "Tested!"; } Since this is VB.NET, if you use Option Strict Off, you could also just continue with it being an object and use late-binding. Of course, then you wouldn't have any Intellisense.
×
×
  • Create New...