• kdock

    kdock

    @kdock

    Viewing 15 replies - 691 through 705 (of 709 total)
    Author
    Replies
    • in reply to: Word Listbox from Excel Worksheet (Office XP) #701229

      Hi Hans,

      I want to present the user with a list of names (with other bits of info). They can choose one or more and insert information into the document. The template in which this listbox resides also gathers a lot of other information to ultimately compile the document. The WP table also presents this same office with names for their WP templates — it’s used in a lot of ways. This is why I would like to keep the document in WP. It gives the client one place to change info and one file to distribute. This is why I’m trying to make it work.

      I have pulled the WP table document into Word and run various macros on it to clean it up. No reason I couldn’t then save it.

      But the bottom line is that I have had no luck populating a listbox data from anywhere. I had code from the MVP site (populating a listbox from a named range in Excel) that gives me an error message that it can’t find the object I’m trying to use. There’s clearly something I’m missing — a reference, perhaps — that is keeping me from successfully getting the data into the listbox.

      I hope I’ve explained it a little better. Thanks for your response.
      Kim

    • in reply to: Copy all wdOrganizerObjects (Office 2000) #691011

      Hi Magella,

      I have done this kind of thing from template to template; you can iterate through all commandbars and styles with a For each statement, but I specified the macro projects by name — seems to me I had problems trying to copy any and all projects.

      Further, some anti-virus programs find this kind of thing *extremely* alarming and might not even permit loading the template with the code in it, let alone stop you from using it without disabling auto-detect.

      I have to agree that the template/document connection is a valuable one and trying to do an end run around it may lead to disappointment — are you trying to make your documents as portable as possible?

      Kim

    • in reply to: Comments Horrible in Word XP (Word XP / original) #687454

      But what a wonderful idea!! clapping

      It certainly gets your attention, and it’s a very stable feature in Word… I can easily add that to the code that inserts the comment in the first place.

      I think I’ll do a little testing and see what response I get from the more sensitive types.

      Thanks!
      K

    • in reply to: Comments Horrible in Word XP (Word XP / original) #687308

      Hi J,

      Oh, I don’t really care about the initials. It’s the highlighting that doesn’t print that I want! Ironically enough, you can change the style of the Comment Text that appears in the Reviewing Pane. What good that does I’m not sure, except that you can enlarge the text if you have a very high resolution monitor.

      Thanks for applying your brain power to this.
      Kim

    • in reply to: Comments Horrible in Word XP (Word XP / original) #687262

      Well,

      Done all that. We used comments as an easy way to pass along important information about a document — they were meant to be read only and the highlighting that didn’t print was a visible cue that some special information existed. The brackets of the current feature are barely visible, even though the hovering works the same.

      Showing the ballons doesn’t work because they print and would need to be acted upon before printing — either delete altogether, which defeats the purpose of the informational comment in the first place, or toggle the balloon off, print, toggle back on. This requires ‘way ‘way too much thinking and again defeats the purpose of an easy-to-use feature. MSoft just made it much harder, is all.

      Oh well — shrug , indeed.

      Thanks very much,
      Kim

    • in reply to: List Template (Word XP) #679033

      Most excellent!

      And thanks for posting his reply.

      K

    • in reply to: List Template (Word XP) #679014

      Hi Trish… The responses in this thread suggesting you copy the style into the document are probably pretty sound. However, knowing what the progression is for this whole process would be helpful. For example, if there’s a possibility that someone with a newer document has somehow edited BodyText in their document would lessen the value of automatically copying the style over it.

      If, on the other hand, your company has strict rules about formatting and no one should be messing with BodyText, well…

      In regard to your original question, and off the top of my head, I suggest that your macro check for the existence of the BodyText style first and if it doesn’t exist, create it. You seemed to say this had occurred to you, but you followed it with “however, a user may select more than one ‘scheme’ (list template) in their document” — how does this impact searching for your BodyText style?

      I *think* what you want to do can be done (that is, if I’m clear on what you want to do), but you may need to build a couple more modules to call in order to separate your error handling code.

      Kim

    • in reply to: If Active Document Contains Style (Word 2002) #679011

      (Edited by HansV to activate link to post – see Help 19)

      Hi Trish, I’m going to post my response to the active thread (post 256454). Hopefully, it will be helpful… Kim

    • in reply to: Newbie needs VBA help (Eng/WordXP/Office2000) #675904

      OK, it sounds like all you need is a mechanism to launch your code. There are a couple of ways to approach this.

      First, you can create a document new event that will run whenever you create a new document from your template. The way to do this is to open your template, then open VBA and find your template in the project explorer (usually on the left top of the window). You should see below the name the “Microsoft Word Objects.” If the folder is closed, click the + next to it to show the “ThisDocument” object. If you double click on it, you should open a blank code window.

      In the code window, type

      Private Sub Document_New()

      **type or copy your code here**

      End Sub

      When you File|New to create a document based on your Subpoena template, the document_new event “fires” as VBA recognizes that you are creating a new document. Your code will run automatically and the document that results should have the results of your input boxes (since it works from running the code from the VBA editor).

      If you want the code to run every time the document is opened, your must put your code in a similar sub routine:

      Private Sub Document_Open()

      **your code here**

      End Sub

      This code will run EVERY time you open the document. It is probably not what you want, so unless there’s an insurmountable reason that the input boxes capture data to an already existing document rather than while the new document is being created, then this isn’t a very good solution. You can Cancel the input boxes, but if you have more than a half dozen, anyone using the documents will become tired of that.

      Because the code is not actually in the document, but really in the template associated with the document, you can associate the Subpoena with another template (like normal.dot) and the prompting will stop. This seems like an unnecessary step, unless there’s something about your document that I don’t know. Do you add information over several editing sessions?

      The last way to run the code is “on demand” by the user. Leave your code where it is in the template (it is in the template and not in normal, right?). Add a button to the toolbar that runs the code. Do that this way:

      Open the Subpoena template. Click Tools|Customize. Click on the Commands tab and in the Categories list, scroll down to “Macros” and click. To the right, you’ll see all the macros that are currently available. Make certain that the “Save in” drop down list at the bottom of the window shows the name of your template.

      **We’re going to save the button to run the code ONLY in the template that has the code. It will only appear when the Subpoena template is active. I like to have a separate toolbar for this kind of thing saved in normal.dot. The buttons come and go as templates are loaded and unloaded from the environment. The bottom line is that they should only appear when it is appropriate to use them.**)

      OK, now scroll down the macros listed on the right of the dialog box until you find your input box macro. Click and drag it to the toolbar of your choice. You can right click and make the button look better — check the options on the context sensitive help.

      Then, you will be able to run your code by clicking on the button. You should, by the way, be able to go to Tools|Macro|Macros (or Alt-F8) and be able to find your code in the list of Macro names. You should also be able to run it from there.

      Note that running a macro or assigning it to a toolbar button requires that your code be public. The two examples I gave above use the word “Private” because only VBA has to find and use them. In order for a user to find and run the code, you need to have your sub look like this:

      Sub MySubRoutine()
      **code**
      End Sub

      -or-

      Public Sub MySubRoutine()
      **code**
      End Sub

      There are other interesting rules about code visibility that you’ll address as you become more proficient. I learned a LOT of code from deconstructing the code that came from Microsoft (though much of it is a lot more than you’ll ever need). I have also made good use of program help (make sure you have the VBA help installed, I think it is not the default to do so). Use the Knowledge Base at microsoft.com and there are several books out there (I think a thread ran last week in this forum on the subject).

      If this doesn’t make sense, please let me know. If it does — good!

      Kim

    • in reply to: Newbie needs VBA help (Eng/WordXP/Office2000) #675852

      Oooops. Then you know all about Word. I assumed you were a WP expert. But you seem to have inherited the Word programming . It sounded as if you worked in a law office; straddling the word processing fence is a common practice for a firm.

      I’m a little confused about your process, though. Your template has the Subpoena form and input boxes. Have you placed the code in a document event such as DocumentNew? That way the input boxes code will run automatically when you create a new document from the template. You can also put them in a DocumentOpen event so they will run whenever the document is opened (this can get very annoying, however, as it will happen EVERY time). You can also put a toolbar button on a new or standard toolbar that will run the sub whenever the user chooses.

      Does any of this do what you want? If so, I can elaborate…

      Kim

    • in reply to: Newbie needs VBA help (Eng/WordXP/Office2000) #675280

      Hi Gwynne,

      OK, this is just my two cents…

      I started working in VBA when my firm decided to make the switch from WordPerfect to Word just before Office 97 came out. It was necessary to jump into VBA immediately, because the hundreds of forms and macros that the whole firm relied on were essential to their practice.

      Here’s where the two cents come in: Remember that you don’t always have to use macros, templates and wizards to do everything in Word. It has its own strengths and weaknesses. You might be able to accomplish a lot of what WP did with a macro using the regular features of Word like autotext and fields. My problem was I knew how to program but I didn’t know so much about Word. (You know that old saying — if the only tool you have is a hammer, every problem looks like a nail.)

      As you’re learning VBA, you will naturally learn Word. Still, you can’t learn Word soon enough — you’ll save yourself a lot of work. And believe me, there will still be plenty of programming to do. grin

      Kim

    • in reply to: If Active Document Contains Style (Word 2002) #672103

      I wish I knew a little more about the circumstances of this macro; I might have just a little more advice 2cents smile

      However, on the face of it, it seems as if you need an error handler.

      This code checks for the style using Set (see below). Setting a value to an object that doesn’t exist produces an error which you can capture and use to your benefit.

      Sub DoesNewStyleExist(fdummy As Boolean)
          ' Check for style named "StyX"
          ' If not there, goes to error handler
          
          Dim StyleExist As Object
          Dim S As Integer
          Dim Style2
          On Error GoTo StyleNotThere
          Set StyleExist = ActiveDocument.Styles("Sty1")
              If StyleExist.NameLocal = ("Sty1") Then
              End If
      Exit Sub
          
      StyleNotThere:
           
      ' Your code to create the styles and link to list template
           
      End Sub

      BTW (and forgive me if you already knew) “(fdummy As Boolean)” keeps a macro from appearing in Word’s list of macros.

      Does this help?

      Kim

    • in reply to: Need to list lines from ComboBox (English/Word97/SR2) #670034

      Instead of using an “equal to” can you use a “less than or equal to” and qualify by the line number rather than the text of the item?

      Just a thought off the top of my head.

      Kim

    • in reply to: List Templates (Word 2000) #664017

      Here’s a little more info from my experience with numbering, for what it’s worth. You can address a specific panel in the List Templates through VBA code:

      ActiveDocument.Styles(“Heading 1”).LinkToListTemplate ListTemplate:= _
      ListGalleries(wdOutlineNumberGallery).ListTemplates(5), ListLevelNumber:=1

      In this code, I linked Heading 1 style to ListTemplate number 5 (the sixth panel, counting from 0 in the upper left). However, there is danger in this. If you reuse this code with frequency, that panel can become corrupted. If you hightlight that panel and click reset, you will clear the corruption. (Or maybe it’s just confusion.)

      The List Templates panel is specific to your computer. You could run the above code on one computer with no problem, but on another computer, the exact code might return an error because that particular panel was corrupted due to overuse. When you open a document, information about the numbering is loaded into one of the List Templates panels on your computer as a temp area in which to display and interpret the numbering from the document.

      MSoft thought users could set up their own numbering schemes here (which works OK if you are the only one using the computer OR the document AND you don’t have more than 7 schemes). But it is far more dynamic than that. A friend and I once passed the same Word 97 document back and forth, making minor changes to the numbering scheme and watched as it used panel 7, then panel 6, then panel 5… until each panel in the List Templates dialog was overwritten (except 0), then started over with 7 again. If I had laboriously set up numbering schemes, they would have been gone with the wind — until I opened a document with one of my schemes in it. Then the next available panel would reflect my numbering scheme.

      So, when I started experiencing corruption in a specific List Template panel, I abandoned trying to address a specific panel. An alternative would be to reset the panel you want to use before addressing it in code. But it seemed to be healthier for the List Templates panels to allow Word to use whatever panel was handy, the code worked just fine without specifying a panel, and I stopped getting reports of error messages.

      I hope this extra info is helpful.

      Kim

    • in reply to: Form with a hyperlink (VBA/Office XP) #657489

      Thanks to all of you for the input. I’ll try them all and see which works best for my situation, but I’m very grateful for the info.

      K

    Viewing 15 replies - 691 through 705 (of 709 total)