• Macros and toolbars (Word 2007)

    Author
    Topic
    #443055

    I’m quite experienced at writing VBA-for-Word macros, and am now trying to understand what new tricks I need to learn to take advantage of Word 2007. I’ve looked at “what’s new” in the Visual Basic Editor’s help, and its “Overview of the Ribbon User Interface”. Lots of stuff there I don’t understand (COM Add-Ins, XML format files, etc).

    I guess I have a number of decisions to make, like:

    • Should I switch from VBA to XML (or even COM add-ins)?
    • If so, where do I go to get started?
    • Would someone like me (self-taught, but experienced) find the switch to XML easy enough (also self-taught with HTML)?
    • Etc, etc, etc
      [/list]Any advice on which direction a lost soul should head to find light at the end of the tunnel, and on how they should get started?
    Viewing 0 reply threads
    Author
    Replies
    • #1067900

      You will still write your code in VBA — or VB.Net if you prefer to create add-ins — but you can no longer easily change the CommandBars. XML is used for structured data, and although there are a lot of complex and tedious reference materials on XML, I suspect that what you really need to know for Office Automation purposes probably is quite simple. Hopefully someone will issue some appropriately simple documentation. smile

      • #1067987

        Good!

        • #1067995
          • #1132497

            I started off really excited, I found a good book (RibbonX, customizing the Office 2007 Ribbon by Robert Martin, Ken Puls, and Teresa Hennig), through this found a little program called the Office 2007 Custom UI editor which saves trying to deal with xml in zip files (which I really couldn’t get my head around – too many steps – and for some reason my laptop doesn’t open zip files unless I use Winzip), and managed to create new tabs, and groups with simple buttons in the ribbon with call backs to VBA. However, now I’m trying to create a tab that contains a checkbox that should select which groups on this tab are displayed. The interface looks fine, but I can’t get it to do anything! All of these articles on MSDN use examples of VB, Visual Studio or C# code, and I don’t have the knowledge to rewrite that in VBA. Everything I have read so far leads me to believe that VBA should be able to handle this, but as I can’t convert any of the examples to VBA I’m pretty stuck.

            Everything I’ve learnt about VBA has been self taught with help from forums such as this lounge and plenty of books, but the scarcity of information, even from Microsoft, is making me very frustrated. Perhaps I’m looking in the wrong place? Can anyone tell me where else to go to find help?

            • #1132498

              Hi Karen
              [indent]


              these articles on MSDN use examples of VB, Visual Studio or C# code, and I don’t have the knowledge to rewrite that in VBA.


              [/indent]
              F.W.I.W. I don’t recall an instance of attempting to do something in VBA where a VB example failed to work in the VBA environment.

            • #1133360

              Hello Don,
              I have attached a zip file which contains two Excel files which each have code copied from the MSDN website, and which I can’t work out how to get to work. The examples on MSDN say we can create these as customized documents, but then go on to talk about Visual Studio 2005 which is what I believe this code is aimed at. I haven’t been able to find Visual Basic examples which actually work, which is why I thought that perhaps this code was not for VBA. I have no experience, nor do I own the product, of Visual Basic (.net or otherwise) or Visual Studio. I solely work in VBA.

              Any help would be appreciated, thanks.

            • #1133403

              Hi Karen

              Regarding the first example (Demo – Customizing.xlsm). The MSDN website expected us to supply the details of the application object. So:
              applicationObject.Range(“A1”).Value = “You clicked the Insert Text button.”
              Should change to something like:
              ThisWorkbook.Sheets(1).Range(“A1”).Value = “You clicked the Insert Text button.”

              Regarding the second example (Demo-Groups.xlsm). I’m afraid that it is beyond me at the moment. Perhaps other loungers could pinpoint the problem. sorry

            • #1132608

              Why do you want to change the ribbon according to a checkbox? You haven’t provided any of your current code or links to your sources so I can’t determine where it isn’t working for you.

              Rather than hide or show groups on a single tab an simpler method would be to build two tabs and show/hide or hide/show according to the checkbox setting. The coding for this should be shorter. The following link can be set to work in a couple of minutes. http://www.amazon.com/gp/blog/post/PLNK3ASJP94966O6L%5B/url%5D

            • #1133359

              Hello Andrew,
              I have attached a zip file which contains the Word document that I am trying to work with. This will eventually be a template loaded into the Startup folder. It contains a description of what I am trying to achieve and why, along with pictures of the toolbars I am trying to replace with groups, and the XML code that makes up the customised tab, groups and buttons.

              Any help would be appreciated.

              Also, do you know with what program I can create my own images for buttons? Specifically png formats?

              Thanks.

            • #1133694

              This version has the toggles working and showing the groups but it doesn’t remember the setting yet. You can see the Custom Document Property that I put in there to store this but I have run out of time to get that part working. Perhaps you can take it further to solve that bit.

              Try this link for help on that bit
              http://gregmaxey.mvps.org/MVP_Customize_Ribbon.htm%5B/url%5D

              On the PNG graphics front it depends on what software you already have. I would make the images with Corel PhotoPaint or Adobe Photoshop or Fireworks but I don’t know what image software you have available. You could also try the opensource alternative of GIMP but all these are probably overkill for a simple icon image. Perhaps the suggestions here would be worth considering.

    Viewing 0 reply threads
    Reply To: Macros and toolbars (Word 2007)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: