VBA bug workaround?

C

Charley Kyd

I'm not able to get around a bug in FrontPage 2003. I'm hoping someone can
suggest a workaround.

Here's the relevant code:
===============
Dim nTbHeight As Integer, pwCur As FrontPage.PageWindow

With pwCur.Document.all.Item("tbMain")
nTbHeight = .offsetHeight
If nTbHeight <> .offsetHeight Then Stop
If nTbHeight < 1000 Then Stop
===============

When I run this code, it stops at the last line. I learn that the value of
..offsetHeight is 7309, but the value of nTbHeight is only 374. Even so, the
code doesn't stop at the first test. For some reason, FrontPage thinks that
374 = 7309, but it correctly determines that 374 < 1000.

I've tried:
nTbHeight = .offsetHeight + 0
nTbHeight = .offsetHeight * 1
nTbHeight = INT(.offsetHeight)
....but nothing I can do will force FrontPage to assign the correct value to
nTbHeight.

I'm using the code to create and save roughly 80 pages, starting with a
standard page that I'm using as a template. Roughly half of the saved pages
have this problem. Each time I run the code I seem to have the problem with
a different set of pages.

I'm running the code from Excel modules.

Help!

Charley
 
M

MD Websunlimited

Charley,

You said, "I'm running the code from Excel Modules" meaning that you're using automation to start and run FP?
 
C

Charley Kyd

Yes. Here are a few lines of code early in the setup process:

Set g_fpApp = New FrontPage.Application
Set g_wbCur = g_fpApp.Webs.Open(g_sRootFolder)
Set g_fldrRoot = ActiveWeb.RootFolder

By the way, when I step through two critical lines of code, the routine
works just fine. One of those lines is...
nTbHeight = .offsetHeight
....which I discussed in my first post.

I ran the code yesterday, stepping at the appropriate times. It turns out
that I the code generates 206 pages, with four mouse clicks per page. Can
you spell carpal tunnel syndrome?

Charley


MD Websunlimited said:
Charley,

You said, "I'm running the code from Excel Modules" meaning that you're
using automation to start and run FP?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top