Re: Capturing the Print command via a macro

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Apparently you can control IE in VB (close cousin to VBA), see sample
snippet below.
Ask you question in this forum where I got the snippet found through a
google search:
http://www.xtremevbtalk.com/

Dim IE as object
Set IE = CreateObject("InternetExplorer.Application")
'create new instance of IE. use reference to return current open IE if
'you want to use open IE window. Easiest way I know of is via title bar.
IE.Navigate "http://www.google.com";
'go to web page listed inside quotes
IE.Visible = True
While IE.busy
DoEvents 'wait until IE is done loading page.
Wend
IE.Document.All("txt1").Value = "what you want to put in text box"

As Jonathan mentioned VBA doesn't have any IE objects to control. You are
better off going to javascript to control IE (or other browsers and
platforms). Try to google the other the forums that deal with those
subjects.

Hi

Thank you Jonathan,
I have managed to get the macro code in the Word document to work in IE if I
use the Ctrl+P keyboard shortcut, but not if I use the File|Print menu
command.

I cant seem to be able to modify the IE menu's as I can in Word.

I would like to disable the Menu items, or even present the document in a
blank IE window. Is this possible?



"Jonathan West" wrote:


"Bill Bowes" <BillBowes@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7F453455-038F-4119-A913-07D24686BE51@xxxxxxxxxxxxxxxx
I have a word document, with a macro that recognises the fact that the user
is going to print, (FilePrint command) and brings up a message box
telling
the user that "Printed copies are uncontrolled", and then places a
watermark
(in the header footer) to put in "printed on...." and puts in the system
date.

All works fine in MS Word, but not all users have Word, some only have
Internet Explorer V6. The macro works fine if the user uses Ctrl P to
print,
but if they go to File|Print from the menu, it does not work.

Help!!! any ideas how I can capture the IE File|Print function???

You can't. Any code in the Word document will not run if it is open in an IE
window.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org




--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

.



Relevant Pages

  • Timer control in VB available in VBA
    ... I believe i read somewhere before, perhaps on this forum that the timer ... control in VB is not available for VBA. ...
    (microsoft.public.excel.programming)
  • Re: Windows Media Player - Javascript Control in Browser is unpred
    ... I've asked this same question on several Web Video type ... - "you want to control the WMP without the control panel?". ... I have tried to read the documentation but it ... this forum for an answer but often the best way to find an answer is to ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Get rid of options on File Menus
    ... Even apps which have even more customizable menus than Word ... can't control that menu. ... so I doubt any of the rest of the Office programs are going to. ... > Word VBA can control menu/toolbar visibility, but I doubt they added any ...
    (microsoft.public.mac.office)
  • Re: Circular dependencies between modules
    ... since a control can be passed as control or as value, ... > Public Sub SetData ... > I get a syntax error on the call statement in frmA! ... > features of the VBA language. ...
    (microsoft.public.access.formscoding)
  • Re: Access ListBox / ComboBox
    ... I'm a basicly a VB developper not VBA but i talk to few of my friends ... Look like that ComboBox or listbox from VBA is not using ... three or four different kinds of control sets, ... in vba 2 columns of data in a list/combo (i dont care as long it's ...
    (microsoft.public.office.developer.vba)