Results 1 to 9 of 9

Thread: (Word 2000)

  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    (Word 2000)

    Hi

    I want to use SendKeys to send quotation marks. For example, what is the SendKeys statement to send this string: "c:test.doc"

    I'm sure it's something simple.
    Dale

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: (Word 2000)

    Well, now, why do you want to use Sendkeys? I bet there's a
    better way. Sendkeys is very unpredictable and unreliable. What
    are you trying to do? May we show you a better way?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: (Word 2000)

    But, if you rather not <img src=/S/argue.gif border=0 alt=argue width=50 height=25> about a better way:

    sendkeys (chr(34)&"C:Test.doc"&chr(34))
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: (Word 2000)

    Thanks Kevin

    I love better ways.

    I have my macros in a separate template, which resides in my addins folder. If I want to make a change to a macro, I have to uninstall the addin (else the macro template opens read-only), open the macro template, return to the document I have open and reinstall the addin (to simplify testing from the open document).

    My first effort was this (ignore the leading quote marks):
    'Public Sub MacrosTemplate_OpenReadWrite()
    'MyMacrosTemplate$ = Application.MacroContainer.Path + Application.PathSeparator + Application.MacroContainer.Name
    'AddIns(MyMacrosTemplate$).Installed = False
    'Documents.Open MyMacrosTemplate$
    'AddIns(MyMacrosTemplate$).Installed = True
    'End Sub

    But, as soon as line 2 is executed, the macro stops running. (Presumably it gets removed from memory.) So I decided to try this instead:
    'Public Sub MacrosTemplate_OpenReadWrite()
    'MyMacrosTemplate$ = Application.MacroContainer.Path + Application.PathSeparator + Application.MacroContainer.Name
    'SendKeys "%fo""" + MyMacrosTemplate$ + """{Enter}", True
    'SendKeys "%{F8}MacrosTemplate_OpenReadWrite_Phase2{Ente r}", True
    'AddIns(MyMacrosTemplate$).Installed = False
    'End Sub
    '
    'Public Sub MacrosTemplate_OpenReadWrite_Phase2()
    'MyMacrosTemplate$ = Application.MacroContainer.Path + Application.PathSeparator + Application.MacroContainer.Name
    'AddIns(MyMacrosTemplate$).Installed = True
    'End Sub


    Thanks for your help
    Dale

  5. #5
    BAM
    Guest

    Re: (Word 2000)

    Hi Dale,

    I have the same situation and I just create a shortcut to the template(s) in the Work menu.That way I can open them at any time to make modifications.

    If you aren't familiar with the Work menu:
    - Right-click any toolbar and select Customize
    - On the Commands tab scroll down and locate the Built-in menus
    category
    - Drag/Drop the Work menu from the Commands to a location of your
    choice

    Although there is an "Add to Work Menu" command that you can use to add a shortcut for the active document, there isn't a "Remove from Work Menu" command. However you can use a keyboard shortcut that will remove menu items for this.

    Should you want to remove a shortcut:
    - Press <Ctrl Alt Hyphen> (mouse pointer will change to a minus sign)
    - Open the Work menu and click the item you wish to remove

    Note that this command will remove any menu item - not just those found under the Work menu.

    To make the removal command easy to remember I modified the Name of the WorkAdd To Work Menu command to include the shortcut so I wouldn't forget. If interested in doing the same, open the Tools/Customize dialog box, right-click the command under the Work menu and add the text to the Name.
    ~~~~~~~~~~~~~~~
    Cheers!

  6. #6
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: (Word 2000)

    For more on the Work menu see <A target="_blank" HREF=http://www.addbalance.com/word/workmenu.htm> How do I use (What is) the Work menu?</A> (addbalance.com/word/workmenu.htm).

    For a menu that creates new documents from templates (rather than opening the templates) see <A target="_blank" HREF=http://www.addbalance.com/word/templatesmenu.htm> I like the Work menu but would like something that lets me draw on my usual list of templates to create new documents - not just open existing ones.</A> (addbalance.com/word/templatesmenu.htm)
    Charles Kyle Kenyon
    Madison, Wisconsin

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: (Word 2000)

    >>But, as soon as line 2 is executed, the macro stops running. (Presumably it gets removed from memory.)

    That's correct. You are trying to execute code that gets removed from memory (or at least de-activated -- whatever .installed = false does in the bowels of Word/VBA).

    I open and edit addins that are installed all the time -- no read only errors. Are you sure someone else does not have the addin open in R/W mode? How about the file attributes? Is Read Only set? Not sure why you have this problem.

    How are you INSTALLing this addin? If you can put this template in your Startup folder, then I've got a great UI form for opening a global app in the VBE to a form or code module. Chris Greaves built on my core and made a real nice VBE Opener. Of course, I've improved on my Opener since then too. A little healthy competition, there, I think.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: (Word 2000)

    Look.

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: (Word 2000)

    That's like asking "Is there any way to continue swimming if I drain the pool?"

    The only reason Sendkeys works for some of your key press action is Sendkeys stuffs a Windows keyboard buffer which holds about 20 keystrokes (at least that's the default). There is a way to increase that, but I don't know how. Probably have to make an entry in the system.ini file!!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •