Solved

EXECWB not working on UNDO/REDO!

Posted on 2003-11-24
14
897 Views
Last Modified: 2012-08-14
Hi experts,

I have used the following syntax(s) to undo/redo a document which is in a VB web browser. But it is not working. But the same command works on save/save as.
WebBrowser1.ExecWB OLECMDID_UNDO, OLECMDEXECOPT_DONTPROMPTUSER
WebBrowser1.ExecWB OLECMDID_REDO, OLECMDEXECOPT_DONTPROMPTUSER

Any idea???
0
Comment
Question by:amiteshsinha
  • 8
  • 6
14 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
What for are you using undo/redo?, what are you trying to undo/redo?
0
 

Author Comment

by:amiteshsinha
Comment Utility
For example I am opening a word document in VB web browser and while editing its contents I may want to make an undo or redo..of whatever I have edited. Hope I am clear.
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 500 total points
Comment Utility
I think you cannot do that way but maybe i am wrong.
Try the following

add a reference to microsoft Word object library to your project
in Documentcomplete event for webbrowser control:
dim wdoc as word.document

if (pdisp is webbrowser1.object then)
     set wdoc =webbrowser1.document
end if

from there, you could use standard Word procedures to do the job.
0
 

Author Comment

by:amiteshsinha
Comment Utility
No..that didn't work. But if I do ctrl+z and ctrl+y it is working. But not on a button click.
Anyother solution???
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
"No..that didn't work"
Could you explain a little bit?
By the way, hotkeys works but that doesn't do the same as execwb commands.
0
 

Author Comment

by:amiteshsinha
Comment Utility
dim wdoc as word.document

if (pdisp is webbrowser1.object then)
     set wdoc =webbrowser1.document
end if

The above said thing didn't work. It is not setting up the document from webbrowser.
But then I found out in microsoft.com that undo and redo command of execwb is " Not currently supported" by webbrowser control.
I have found a solution like capturing the ctrl z and ctrl y keys on button clicks.

Thanks for your responses.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
i don't understand why you said it didn't work. I used it with no problems.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:amiteshsinha
Comment Utility
It throws the following error

run-time error '13':
type mismatch

in the line

set wdoc =webbrowser1.document
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
Sorry, i didn't get that error.
Where you put the code that i gave you?
0
 

Author Comment

by:amiteshsinha
Comment Utility
in Documentcomplete event
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
Please, replace the path at navigate method from the example at form_load to a valid one.
0
 

Author Comment

by:amiteshsinha
Comment Utility
thanks a lot Richie, this works. But then this is not the answer for my initial question and also I have found a solution for it, hence closing this.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
Maybe not the answer that you want but my comment at 11/24/2003 09:13AM PST is correct.
Cheers
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now