Macro in FrontPage?

G

Guest

I composed a macro in Word to use in FrontPage (because couldn't use the
vb-editor to create it directly in FrontPage). I then copied the macro code
into the FrontPage macro. But it does not run in FrontPage. It is a short
marcro simply to open a series of 4 files (see code below). Anyone know how I
can modify this to make it work in FrontPage? Thanks very much for any help.
Here is the macro code (with fake filenames):

Sub Market_City_Changes()
'
' Market_City_Changes Macro
' Market city changes
'
ChangeFileOpenDirectory "C:\Bob\Awebsite\"
Documents.Open FileName:="""index.htm""", _
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto
ChangeFileOpenDirectory "C:\Bob\Awebsite\XXTTYY\"
Documents.Open FileName:="""xxyyzz.htm""", _
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto
ChangeFileOpenDirectory "C:\Bob\Awebsite\include\"
Documents.Open FileName:="""bbccdd.htm""", ConfirmConversions:=False _
, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
ChangeFileOpenDirectory "C:\Bob\Awebsite\"
Documents.Open FileName:="""ffggaa.htm""", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
End Sub
 
J

Jim Cheshire

webeditor-coutre said:
I composed a macro in Word to use in FrontPage (because couldn't use
the vb-editor to create it directly in FrontPage). I then copied the
macro code into the FrontPage macro. But it does not run in
FrontPage. It is a short marcro simply to open a series of 4 files
(see code below). Anyone know how I can modify this to make it work
in FrontPage? Thanks very much for any help. Here is the macro code
(with fake filenames):

The object model is completely different in Word and FrontPage. You cannot
write a macro in one and have it run in the other.

Did you do it this way because Word allowed you to record a macro while
FrontPage requires you to write one?

--
Jim Cheshire
JIMCO Software
http://www.jimcoaddins.com

The premiere add-in and software source
for Microsoft FrontPage.
 
J

Jim Cheshire

webeditor-coutre said:
I composed a macro in Word to use in FrontPage (because couldn't use
the vb-editor to create it directly in FrontPage). I then copied the
macro code into the FrontPage macro. But it does not run in
FrontPage. It is a short marcro simply to open a series of 4 files
(see code below). Anyone know how I can modify this to make it work
in FrontPage? Thanks very much for any help. Here is the macro code
(with fake filenames):

A similar macro in FrontPage would look like this.

Public Sub OpenFiles()

ActiveWebWindow.PageWindows.Add "index.htm"
ActiveWebWindow.PageWindows.Add "XXTTYY/xxyyzz.htm"
ActiveWebWindow.PageWindows.Add "include/bbccdd.htm"
ActiveWebWindow.PageWindows.Add "ffggaa.htm"

End Sub

You would also want to add in some error handling to make this robust, but
that's something you probably already know.
--
Jim Cheshire
JIMCO Software
http://www.jimcoaddins.com

The premiere add-in and software source
for Microsoft FrontPage.
 
G

Guest

That's a huge help. Thanks very much.


Jim Cheshire said:
A similar macro in FrontPage would look like this.

Public Sub OpenFiles()

ActiveWebWindow.PageWindows.Add "index.htm"
ActiveWebWindow.PageWindows.Add "XXTTYY/xxyyzz.htm"
ActiveWebWindow.PageWindows.Add "include/bbccdd.htm"
ActiveWebWindow.PageWindows.Add "ffggaa.htm"

End Sub

You would also want to add in some error handling to make this robust, but
that's something you probably already know.
--
Jim Cheshire
JIMCO Software
http://www.jimcoaddins.com

The premiere add-in and software source
for Microsoft FrontPage.
 

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