Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Excel VBA Window Resize


Reply
 
Thread Tools Display Modes
  #1  
Old 05-21-2009, 04:59 PM
Josh Hazel Josh Hazel is offline
Senior Contributor
 
Join Date: May 2008
Posts: 805
Default Excel VBA Window Resize


Is there a way I can resize a window. I am using FollowHyperlink and in some cases OLE to create IE windows but depending on what I have opened I would like for that specific window to open smaller or larger ... is there a way to do this?
__________________
Josh

If Google = NoHelp Then PostHere = True
Reply With Quote
  #2  
Old 05-22-2009, 01:30 AM
TerryTee TerryTee is offline
Contributor
 
Join Date: Aug 2003
Location: Norway
Posts: 450
Default

I'm not expert on IE, javascript or command lines, but I'd still play around with stuff like this:
Code:
Shell """C:\Program Files\Internet Explorer\IEXPLORE.EXE"" javascript:window.resizeTo(500,500);location.href='http://www.xtremevbtalk.com/';"
Reply With Quote
  #3  
Old 05-22-2009, 03:36 PM
Josh Hazel Josh Hazel is offline
Senior Contributor
 
Join Date: May 2008
Posts: 805
Default

Quote:
Originally Posted by TerryTee View Post
I'm not expert on IE, javascript or command lines, but I'd still play around with stuff like this:
Code:
Shell """C:\Program Files\Internet Explorer\IEXPLORE.EXE"" javascript:window.resizeTo(500,500);location.href='http://www.xtremevbtalk.com/';"
I tested that code and it didnt seem to even open an ie window for me... But .... What if the window is already open?
__________________
Josh

If Google = NoHelp Then PostHere = True
Reply With Quote
  #4  
Old 05-22-2009, 05:20 PM
TerryTee TerryTee is offline
Contributor
 
Join Date: Aug 2003
Location: Norway
Posts: 450
Default

As I said, not too sure...
Anyway, a challenge is that you can’t easily intercept the FollowHyperlink event.
Can you use a button, or a SelectionChange Event to fire your own hyper link function? If so an InternetExplorer object should do it.

Code:
 
    Dim browser As Object
    Set browser = CreateObject("InternetExplorer.Application")
    
    browser.Navigate "http://www.xtremevbtalk.com/"
    With browser
        .Top = 0
        .Left = 0
        .Height = 500
        .Width = 500
    End With
    While ibrowsere.busy
      DoEvents
    Wend
Otherwise you can try to put javascript code directly into the hyperlink in the worksheet in a similar fashion to what I did with the Shell (which works for me).


-Terry
Reply With Quote
  #5  
Old 05-22-2009, 06:01 PM
Roger_Wgnr's Avatar
Roger_Wgnr Roger_Wgnr is offline
CodeASaurus Hex

Forum Leader
* Expert *
 
Join Date: Jul 2006
Location: San Antonio TX
Posts: 2,427
Default

One note about the Javascript. (at least I think I'm right here)
For the javascript code to work you must have Java enabled in IE.
If you have turned off Java in IE the code will not work (this may be why the Shell command did not do anything).
__________________
Code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ~Martin Golding
The user is a peripheral that types when you issue a read request. ~Peter Williams
MSDN Visual Basic .NET General FAQ
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->