Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I test a macro?

0 views
Skip to first unread message

Phil Rabichow

unread,
Dec 11, 1999, 3:00:00 AM12/11/99
to
I have Win98SE & Word 2K. I seem to remember (maybe it was a dream)
that in Word 95 with Win95, that I could split the screen. I could have
a test document open & run a macro line by line, to see what it did to
my test document.

I can't seem to do this with Word 2K & VBA. Is there a way?
--
Thank you in advance.

Phil
P.S. Responding in the newsgroup is fine, as I will check back. If you
wish to respond to me directly, please remove the ZZ after my name & ZZ
before the domain name.

Cindy Meister -WordMVP-

unread,
Dec 13, 1999, 3:00:00 AM12/13/99
to
Hi Phil,

> I have Win98SE & Word 2K. I seem to remember (maybe it was a dream)
> that in Word 95 with Win95, that I could split the screen. I could have
> a test document open & run a macro line by line, to see what it did to
> my test document.
>
> I can't seem to do this with Word 2K & VBA. Is there a way?
>

I size the Word and VBEditor windows to "restored" mode and so that I can
see (at least part of) both. By pressing F8 (while focus is in the VBE
window!) you can step through the code line-by-line.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://go.compuserve.com/MSWord

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)


Phil Rabichow

unread,
Dec 14, 1999, 3:00:00 AM12/14/99
to
Thanks, Cindy. It worked. Too bad I can't just hit Arrange All in the
Windows menu but the VBA Editor is separate.
--

Cindy Meister -WordMVP-

unread,
Dec 15, 1999, 3:00:00 AM12/15/99
to
Hi Phil,

> Too bad I can't just hit Arrange All in the
> Windows menu but the VBA Editor is separate.
>

Now, that's an interesting idea <g> Try the following...it worked for
me:

Sub ArrangeCurrWordAndOtherAppWindows()
Dim Wordwn As Window
Dim VBEwn As Task
Dim OtherApp As String
Dim nAvailWidth As Single

OtherApp = "Microsoft Visual Basic"
nAvailWidth = Word.Application.UsableWidth / 2

Set Wordwn = Word.Application.ActiveWindow
If Tasks.Exists(OtherApp) Then
Set VBEwn = Tasks(OtherApp)
Else
Exit Sub
End If
With Wordwn
.WindowState = wdWindowStateNormal
.Left = 0
.Top = 0
.Width = nAvailWidth
.Height = Application.UsableHeight
End With
With VBEwn
.WindowState = wdWindowStateNormal
.Left = nAvailWidth
.Top = 0
.Width = nAvailWidth
.Height = Application.UsableHeight
End With
End Sub

Phil Rabichow

unread,
Dec 16, 1999, 3:00:00 AM12/16/99
to
Haven't tried it yet but I'm sure it'll work. You've made my century
(with 14 days to go).
--
Thanks.

Howard Kaikow

unread,
Dec 17, 1999, 3:00:00 AM12/17/99
to
THe century does not end until 31 December 2000.

--
Please reply only to newsgroup.
Phil Rabichow <phr...@ZZearthlink.net> wrote in message
news:3859B8F1...@ZZearthlink.net...

Phil Rabichow

unread,
Dec 17, 1999, 3:00:00 AM12/17/99
to
> Haven't tried it yet but I'm sure it'll work. You've made my century
> (with 14 days to go).
> --
> Thanks.
>
> Phil
Howard Kaikow wrote:

> THe century does not end until 31 December 2000.

Well, you're right, but of course "my" century could end sooner. Maybe I'll
just have to have a very mundane 14 to 380 days.
Phil


Cora Aquino Yockers

unread,
Dec 17, 1999, 3:00:00 AM12/17/99
to
Hi, Phil -

I just right click on the taskbar and choose Tile Windows (usually
horizontally).

- Cora A. Yockers

Please respond by posting to the newsgroup, not e-mailing me directly. But
if you need to e-mail me, add an underscore between CKS and grad.

---

Phil Rabichow <phr...@ZZearthlink.net> wrote in message
news:3859B8F1...@ZZearthlink.net...

Haven't tried it yet but I'm sure it'll work. You've made my century
(with 14 days to go).
--
Thanks.

Phil

John McGhie [MVP - Word]

unread,
Dec 19, 1999, 3:00:00 AM12/19/99
to
Cora:

Now YOU have made MY century!

I have been looking for Tile/Vertically ever since they took it off the
Window menu in Word :-)

Many thanks.

On Fri, 17 Dec 1999 13:48:12 -0500, "Cora Aquino Yockers"
<cks...@yahoo.com> wrote:

> Hi, Phil -
>
> I just right click on the taskbar and choose Tile Windows (usually
> horizontally).
>
> - Cora A. Yockers
>
> Please respond by posting to the newsgroup, not e-mailing me directly. But
> if you need to e-mail me, add an underscore between CKS and grad.
>
> ---
>
> Phil Rabichow <phr...@ZZearthlink.net> wrote in message
> news:3859B8F1...@ZZearthlink.net...
> Haven't tried it yet but I'm sure it'll work. You've made my century
> (with 14 days to go).


Please post follow-up questions to the newsgroup so that all may follow the thread.

John McGhie <jo...@mcghie-information.com.au>
Consultant Technical Writer
Microsoft MVP (Word)
Sydney, Australia (GMT +10 hrs) +61 (04) 1209 1410

Cindy Meister -WordMVP-

unread,
Dec 21, 1999, 3:00:00 AM12/21/99
to
Hi John,

> I have been looking for Tile/Vertically ever since they took it off the
> Window menu in Word :-)
>

I've had a macro for this since Word97 :-) Advantage: it tiles only the
Word windows, not anything else I may have open. Works in 2K with no
problems, as well. Here:

Sub DocsArrangeVertical()
Dim wnd As Word.Window
Dim appHeight As Long, appWidth As Long
Dim lWindows As Long, appLeft As Long
Dim lChildTitleBar As Long

ScreenUpdating = False
'Korrekturfaktor für das erste Fenster
appLeft = -1
With Application
'Fenster Info holen
Set wnd = .ActiveWindow
lWindows = .Windows.Count
'Fensterbreite auf zur Verfügung stehende
'Breite, geteilt durch Anzahl Fenster
appWidth = .UsableWidth / lWindows
End With

For Each wnd In Word.Application.Windows
'Fenstergrösse "Wiederherstellen"
'Muss für jedes Fenster in Word2000
'ausgeführt werden
wnd.WindowState = wdWindowStateNormal
wnd.Width = appWidth
'Fensterhöhe
wnd.Height = Application.UsableHeight
'Position links setzen
wnd.Left = appLeft
'Position oben setzen
wnd.Top = 0
'nächste Position links berechnen
'(letzte Position + Fensterbreite
appLeft = appLeft + wnd.Width
Next

Phil Rabichow

unread,
Dec 22, 1999, 3:00:00 AM12/22/99
to
Cindy Meister -WordMVP- wrote:

Thanks, Cindy (& Cora too). Cindy, do you have an English translation for
the remarks? It would help a beginner.


--
Thank you in advance.

Phil

Cindy Meister -WordMVP-

unread,
Dec 23, 1999, 3:00:00 AM12/23/99
to
Hi Phil,

> Cindy, do you have an English translation for
> the remarks?
>

Whoops, sorry. I wrote an article for a German magazine... Some of the
comments may seem awfully obvious, but that's because VBA is in
English, so wasn't necessarily obvious to my intended audience :-) (You
should have heard our conversation about the .Collapse method <g>)

> ScreenUpdating = False
> 'Correct factor for positioning first window


> appLeft = -1
> With Application

> 'Get number of windows


> Set wnd = .ActiveWindow
> lWindows = .Windows.Count

> 'Set window width to available width
> 'divided by number of windows


> appWidth = .UsableWidth / lWindows
> End With
>
> For Each wnd In Word.Application.Windows

> '"Restore" the windows size
> 'Must be done for every window in W2K


> wnd.WindowState = wdWindowStateNormal
> wnd.Width = appWidth

> 'Window height
> wnd.Height = Application.UsableHeight
> 'Set left position
> wnd.Left = appLeft
> 'Set top position
> wnd.Top = 0
> 'calculate next window's left position
> '(last position + window width)


> appLeft = appLeft + wnd.Width
> Next
>
> End Sub

Cindy Meister

John McGhie [MVP - Word]

unread,
Dec 24, 1999, 3:00:00 AM12/24/99
to
Cindy:

Anyone tell you recently that you're worth more money?

I am truly grateful :-)

Cheers.

On Tue, 21 Dec 1999 15:40:06 +0100, Cindy Meister -WordMVP-
<CindyM...@swissonline.ch> wrote:

> Hi John,
>
> > I have been looking for Tile/Vertically ever since they took it off the
> > Window menu in Word :-)
> >

> I've had a macro for this since Word97 :-) Advantage: it tiles only the
> Word windows, not anything else I may have open. Works in 2K with no
> problems, as well. Here:
>
> Sub DocsArrangeVertical()
> Dim wnd As Word.Window
> Dim appHeight As Long, appWidth As Long
> Dim lWindows As Long, appLeft As Long
> Dim lChildTitleBar As Long
>
> ScreenUpdating = False
> 'Korrekturfaktor für das erste Fenster

> appLeft = -1
> With Application

> 'Fenster Info holen


> Set wnd = .ActiveWindow
> lWindows = .Windows.Count

> 'Fensterbreite auf zur Verfügung stehende
> 'Breite, geteilt durch Anzahl Fenster

> appWidth = .UsableWidth / lWindows
> End With
>
> For Each wnd In Word.Application.Windows

> 'Fenstergrösse "Wiederherstellen"
> 'Muss für jedes Fenster in Word2000
> 'ausgeführt werden

> wnd.WindowState = wdWindowStateNormal
> wnd.Width = appWidth

> 'Fensterhöhe
> wnd.Height = Application.UsableHeight
> 'Position links setzen
> wnd.Left = appLeft
> 'Position oben setzen
> wnd.Top = 0
> 'nächste Position links berechnen
> '(letzte Position + Fensterbreite

> appLeft = appLeft + wnd.Width
> Next
>
> End Sub
>
>
> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister
> http://go.compuserve.com/MSWord
>
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)

Cindy Meister -WordMVP-

unread,
Dec 24, 1999, 3:00:00 AM12/24/99
to
Hi John,

> Anyone tell you recently that you're worth more money?
>

<LOL>! Nope...

0 new messages