Visual Basic: MS Word Macro

Discuss all aspects of programming here.

Moderator: The Mod Squad

Visual Basic: MS Word Macro

Postby ½mv² » Fri Nov 03, 2006 2:01 pm

This should be a pretty simple question for anyone familiar with VB. I just don't use VB enough to know what the function is called, and I'm not even sure what it would be called, so looking for it is kinda tricky...

The Question:
Is there a way to create a string in VB and then place it onto the copy/paste clipboard? For example, I run a macro that generates a string, and then the macro places the string onto the clipboard so that I can paste it wherever I want with Ctrl-V?

It would look something like this:
    sub KineticsMacro()
      Dim KineticsString As String
      KineticsString = "Hello World"
      <Insert function that puts my string on the clipboard>
    end sub
Then when I press Ctrl-V, the string "Hello World" will paste into whatever document I have open.

And for those of you that require more information...

The situation:
I have a word document with about 50 check boxes in it. The client takes this form, checks off the applicable boxes, and resubmits it to me. More often than not, 30 or more checkboxes will be checked. To dummy-proof the form (for the client & people on my team), the document is to remain in "Locked/Secure" mode at ALL TIMES, and each checkbox was created as a VB object so that macros could be assigned to them.

The problem:
When I get this form, I need to copy the information from the form into a database, including a list of everything that was checked. Unfortuneately, since the document is always Locked-down, you can only highlight/copy/paste text that resides in designated unprotected "free text" areas. Since we can't risk a client changing the text for each checkbox, we have no way of performing a copy/paste from the form into our database...
...and entering 30 or more sever names for every form that we get requires WAY too much of our time.
Black Belt
Black Belt
Posts: 502
Joined: Fri Nov 18, 2005 10:09 am
Location: United States

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests