Solved

EXECWB not working on UNDO/REDO!

Posted on 2003-11-24
14
919 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
[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
  • 8
  • 6
14 Comments
 
LVL 16

Expert Comment

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

Author Comment

by:amiteshsinha
ID: 9811915
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
ID: 9811962
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:amiteshsinha
ID: 9812219
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
ID: 9812475
"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
ID: 9812652
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
ID: 9812688
i don't understand why you said it didn't work. I used it with no problems.
0
 

Author Comment

by:amiteshsinha
ID: 9812769
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
ID: 9812843
Sorry, i didn't get that error.
Where you put the code that i gave you?
0
 

Author Comment

by:amiteshsinha
ID: 9812853
in Documentcomplete event
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9812930
0
 
LVL 16

Expert Comment

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

Author Comment

by:amiteshsinha
ID: 9812987
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
ID: 9813136
Maybe not the answer that you want but my comment at 11/24/2003 09:13AM PST is correct.
Cheers
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

726 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