Word 2007 VBA Macros Disappear

Posted on 2009-12-21
Last Modified: 2013-11-25
I have a bunch of macros written in VBscript that I run from a Macro-Enabled Word Document (.DOCM) in MS Word 2007.

In general, all of my macros work, except one that I recently changed to accept an argument/function parameter. This is designed to allow me to parameterize an existing function. For some reason, whenever I give my vba macros the ability to use function parameters, they disappear on me. Any suggestions?

Thank you,

The code is:

Sub RunMyFavMacro(sParam1 As String)
End Sub

Open in new window

Question by:dogbertius
    LVL 9

    Accepted Solution

    Insert the below code and run this code instead.
    Sub RunFavMac()
    call RunMyFavMacro
    End Sub
    LVL 1

    Author Closing Comment

    There is another post on here (which I can't find anymore) which described setting a .param field

    Basically, with VB in Word (2007) I can't directly pass formal function parameters as I could in a stronger language like C. Instead, I need to define .param  entries and then issue lengthy callbacks. Good thing this is a simple app :)

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
    This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now