Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Insert a VB Created HTML Form into Word

Posted on 2004-04-23
7
Medium Priority
?
193 Views
Last Modified: 2010-05-02
Brief Overview:
==========

I have placed a customized menu item in MS Word 2000 that launches a VBA program that permits the user to make a selection from a list of HTML submission forms.  e.g., Contact Us, etc.

The user selects a specific form, and the VBA app calls a stubbed function in an ActiveX EXE automation server that creates the HTML form on-the-fly based on XML/DTD docs and returns the "raw" HTML code.

I then "smack" the HTML form into MS Word at the current cursor location using:

   Selection.InsertFile FileName

It work fine... It looks correct on the screen... EXCEPT...

Word arbitrarily inserts a </form> statement immediately after the first element (e.g., textbox).

Obviously, there must be a better approach than simply reading a file directly into Word.

Can anyone assist me in this regard?

Thanks in advance.

Robert Cezar


 
 

0
Comment
Question by:RobertCezar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Expert Comment

by:OHDev2004
ID: 10903145
can't you just paste the raw html code in a one-time
because sometimes word compiles the html code just like frontpage ,,
what happens if i'm understanding it right:
when you start to  smack :) the html form Word Reads every line of it ,, then when it finds <form> and a form object after it like a textbox or button it closes the Form tag ,, so i think the better way is to paste it as a whole text ,,

try it with the clipboard ,
hope i didn't mess it up more than it already is :) lol
0
 
LVL 1

Author Comment

by:RobertCezar
ID: 10903689
I will give it a shot and let you know.
0
 
LVL 1

Author Comment

by:RobertCezar
ID: 10908093
Well,

It kind-of-works!   I can successfully paste the form into the Word document as long as it's outside an existing table. If the application inserts the form <object> inside and existing table (since the FORM object being inserted has an outer table... naturally), I receive a Stack Overflow error.

Back to the drawing board!

Robert
0
 
LVL 5

Expert Comment

by:JMoon5FTM
ID: 10910909
Sounds strange...are we sure your ActiveX EXE is generating good HTML?  Can you post the example form you're working with?
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 11447647
PAQed - no points refunded (of 500)

Netminder
Site Admin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 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