Re: Using Workbook.XMLImport

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Gary,

Regarding your response to the "running a macro" topic. I have been able to
get that running, but it has some drawbacks in that when used on another
machine, the macro requires either the user reduce their security setting or
the macro author (me) sign the macro. To this point, I have just had the
user reduce their security setting, simply because I do not have experience
with signing macros. In addition, the macro I constructed for the
Proof-Of-Concept has a hard coded filename as the XML source - something
that must eventually be programatically set (I will need to work on this
some more, if I find the macro approach as my choice).

Questions:
Any ideas on how involved macro signing is? How about techniques of
changing the hard-coded XML filename?

It's simple enough in execution: Tools/Digital Signature. The bigger question is
obtaining a certificate. If your company has Windows Server 2003 it can generate
certificates for company use, no problems. It's also possible for you to use
selfcert.exe to create certificates and use them on other machines. You just need to
realize this isn't "secure". The other option is to purchase a certificate from a
company such as Verisign or Thawte.

As for my perferred approach of using the ThisWorkbook object inside a
managed code base (C#). I do get the intellesense menu showing the
XMLImport method for the ThisWorkbook object. My problem is figuring out
how to construct the parameters in the method. I have made enough progress
to figure out what type the parameters are supposed to be (wow!), and think
my problem lies in the consstruction and use of the Excel.XmlMap object. I
have my code and the error message generated listed below this post.

Question:
Any ideas on how I can get the XmlMap method to work?

I'd need to find some time to test, Excel isn't my primary application... (Post a
reply to this to keep it on my radar, I may find some time later this week if you're
still struggling)

The article link in my previous post, even though it is for VS2005, shows
several code statements performing interop unwrapping and all kinds of
convoluted / complicated stuff.

I can't imagine this should be necessary...

Late breaking discovery:
The first parameter, a string, I think should contain the XML string - tags
etc. I will have to brush up on my stream construction (I have always had
some problems with streams).

Questions
Any suggestions on how this approach may turn out? How about a head start
on constructing the stream?


////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
Excel.XmlMap myMap = ThisWorkbook.XmlMaps.Add (myInputDS.GetXmlSchema(),
ThisWorkbook.XmlImportXml (
@"C:\myDir\SAMPLE1.XML",
out myMap,
true,
ThisWorkbook.Sheets[1]);


////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :-)

.



Relevant Pages

  • Re: Help with a macro
    ... The certificate numbers are stored in a text file "Settings.ini" which is ... I have added a macro to reset the certificate number should that be ... Dim SettingsFile As String ... Word MVP web site http://word.mvps.org ...
    (microsoft.public.word.docmanagement)
  • Re: Using Control Toolbox
    ... Thanks for telling me how to create a self certificate, ... Now that I have the certificate, is it okay to change the macro security ... Bill's version automatically inserts a bullet each time you ... Private Sub TextBox1_Change ...
    (microsoft.public.powerpoint)
  • Re: hide/protext auto_open code so user cant prevent it from running
    ... digitally sign a file or a macro project by using a digital certificate. ... certificate used to create this signature confirms that the macro or document ... When you set the macro security level, you can run macros based on ...
    (microsoft.public.excel.programming)
  • Re: hide/protext auto_open code so user cant prevent it from runn
    ... digitally sign a file or a macro project by using a digital certificate. ... certificate used to create this signature confirms that the macro or document ... When you set the macro security level, you can run macros based on ...
    (microsoft.public.excel.programming)
  • Re: Name truncated in digitally signing?
    ... name was truncated by the MS Office Security dialog box. ... If a certificate is assigned to the macro, which MS recommends, ... set the certificate name to anything an "&". ... Instead of "Beavis & Butthead", it shows only, "Beavis ...
    (microsoft.public.excel.programming)