Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3318706
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:44:17+00:00 2026-05-17T22:44:17+00:00

In an already open word document select all text copy selected text to clipboard

  • 0

In an already open word document select all text
copy selected text to clipboard
check default browser open at correct web address
if not open default browser at web address “http://thisaddress.com“
give focus to browser
paste clipboard text into input box called “input1”

or some other way to get MSword document contents to a web page input?

Currently the workflow involves a secretary logging in to the website, then filling out a web form, switching to their open MS Word document, selecting all, copying the WP document, then back to the web form and pasting into an input box, then hitting submit. What I want to do ideally have a button in MS word which opens the browser to the correct web page then copies and pastes the document into the correct input box on the page (in fact it will be the only textarea form field).

The MS Word VBA code is:

Option Explicit

Enum W32_Window_State
    Show_Normal = 1
    Show_Minimized = 2
    Show_Maximized = 3
    Show_Min_No_Active = 7
    Show_Default = 10
End Enum

Private Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" (ByVal hWnd As Long, _
    ByVal lpOperation As String, ByVal lpFile As String, _
    ByVal lpParameters As String, ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long

Function OpenURL(URL As String, WindowState As W32_Window_State) As Boolean

' Opens passed URL with default application, or Error Code (<32) upon error

    Dim lngHWnd As Long
    Dim lngReturn As Long

    lngReturn = ShellExecute(lngHWnd, "open", URL, vbNullString, _
        vbNullString, WindowState)

    OpenURL = (lngReturn > 32)
End Function

Sub TestMacro()
  Application.ActiveDocument.Select
  Selection.Copy
  OpenURL "http://localhost:8500/index.cfm?wordContent=" & Selection, W32_Window_State.Show_Maximized
End Sub

and in the coldfusion handling form

<html>
<head>
</head>

<body>
<form id="form1">
    <Textarea ID="txtArea" rows=6><cfoutput>#url.wordContent#</cfoutput></textarea>
</form>

</body>
</html>

Just would like to work out how to not open a new browser window if one is already open.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:44:18+00:00Added an answer on May 17, 2026 at 10:44 pm

    In case you can modify the web-application, you may do the following:

    1. MS-Word: Copy content to clipboard.
    2. MS-Word: Open Url as “http://thisaddress.com/SomePage?pasteClipboard=true”
    3. SomePage: if query-string param pasteClipboard == true, then add a javascript function to get the clipboard data into your form field.

    Update:

    In your macro you simply call Selection.Copy, and to open the URL using default browser check this link http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_23225744.html

    Using the code from the previous link, I made a test macro as :

    Sub TestMacro()
      Application.ActiveDocument.Select
      Selection.Copy
      OpenURL  "http://thisaddress.com/SomePage?pasteClipboard=true", W32_Window_State.Show_Maximized
    End Sub
    

    I hope this was helpful.

    Update 2:

    Just use W32_Window_State.Show_Default, Here is the full macro:

    Option Explicit
    
    Enum W32_Window_State
        Show_Normal = 1
        Show_Minimized = 2
        Show_Maximized = 3
        Show_Min_No_Active = 7
        Show_Default = 10
    End Enum
    
    Private Declare Function ShellExecute Lib "shell32.dll" _
        Alias "ShellExecuteA" (ByVal hWnd As Long, _
        ByVal lpOperation As String, ByVal lpFile As String, _
        ByVal lpParameters As String, ByVal lpDirectory As String, _
        ByVal nShowCmd As Long) As Long
    
    Function OpenURL(URL As String, WindowState As W32_Window_State) As Boolean
    
    ' Opens passed URL with default application, or Error Code (<32) upon error
    
        Dim lngHWnd As Long
        Dim lngReturn As Long
    
        lngReturn = ShellExecute(lngHWnd, "open", URL, vbNullString, _
            vbNullString, WindowState)
    
        OpenURL = (lngReturn > 32)
    End Function
    
    Sub TestMacro()
      Application.ActiveDocument.Select
      Selection.Copy
      OpenURL "http://thisaddress.com/SomePage?pasteClipboard=true", W32_Window_State.Show_Default
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I check to see if a file is already open by another
So I need to edit some text in a Word document. I created a
We are already working in MS-WORD 2007 with C#4.0(WIN FORM Application) by using open
How can I check if a file is already open before trying to delete
If a MySQL database connection is already open from a script (say PHP ),
Is it possible to change the name of an already open memory mapped file,
Possible Duplicate: Entity Framework: There is already an open DataReader associated with this Command
Can I avoid the open DataReader exception (There is already an open DataReader associated
May be some body already used some open source component, writing on jquery. And
I am using XCode 4.3.2 and trying to open an already existing project based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.