FP2003 Export Package via Code

D

Derek

Hi

I am trying to develop a client application in VB.Net to export a package in FrontPage 2003 and save it to a location of my choosing. Thee following VBA code from within FrontPage 2003 runs but the file created is only 1k thus not a full export. I need to export Web Sites under the root and all of the Files, Folders etc. associated with that Web Site. If I could allow the user to select what he or she would like to export within the VB.Net App. that would be nice too.

Sub export(
Dim myWeb As WebE
myweb = Application.ActiveWe
Dim objWebWindow As WebEx

For Each myweb In Application.Web
For Each Folder In myweb.AllFolder
If Folder.IsWeb And Not Folder.IsRoot The
If Folder.Name = "ASC" The
Dim myWebPackage As WebPackag
Set objWebWindow = Webs.Open(ActiveWeb & "/" & Folder.Name, , , fpOpenNoWindow
Set myWebPackage = objWebWindow.CreatePackage("test_package"
x = myWebPackage.Add(objWebWindow, fpDepsDefault
Call myWebPackage.Save("c:\test_package", 1
End I
End I
Next Folde
Next mywe
End Sub
 
P

Peter Aitken

Derek said:
Hi,

I am trying to develop a client application in VB.Net to export a package
in FrontPage 2003 and save it to a location of my choosing. Thee following
VBA code from within FrontPage 2003 runs but the file created is only 1k
thus not a full export. I need to export Web Sites under the root and all of
the Files, Folders etc. associated with that Web Site. If I could allow the
user to select what he or she would like to export within the VB.Net App.
that would be nice too..
Sub export()
Dim myWeb As WebEx
myweb = Application.ActiveWeb
Dim objWebWindow As WebEx

For Each myweb In Application.Webs
For Each Folder In myweb.AllFolders
If Folder.IsWeb And Not Folder.IsRoot Then
If Folder.Name = "ASC" Then
Dim myWebPackage As WebPackage
Set objWebWindow = Webs.Open(ActiveWeb & "/" &
Folder.Name, , , fpOpenNoWindow)
Set myWebPackage = objWebWindow.CreatePackage("test_package")
x = myWebPackage.Add(objWebWindow, fpDepsDefault)
Call myWebPackage.Save("c:\test_package", 1)
End If
End If
Next Folder
Next myweb
End Sub

I don;t know anything about exporting webs so cannot help with the
specifics. But your approach seems very confused. You *do* know the
distinction between VBA and VB.Net? They are completely distinct things yet
your code seems to combine aspects of both. For example you use Set in some
places (VBA) and not in others (VB.Net). Are you trying to write a VBA app
or a VB.Net app?
 
J

John Jansen \(MSFT\)

I think you want this (notice, you didn't have the path to any files inside
the site and I gave the save command a file extension):

Sub exportWeb()
Dim myWeb As WebEx
Set myWeb = Application.ActiveWeb
Dim objWebWindow As WebEx

For Each myWeb In Application.Webs
For Each Folder In myWeb.AllFolders
If Folder.IsWeb And Not Folder.IsRoot Then
If Folder.Name = "ASC" Then
Dim myWebPackage As WebPackage
Set objWebWindow = Webs.Open(ActiveWeb & "/" &
Folder.Name, , , fpOpenNoWindow)
Set myWebPackage =
objWebWindow.CreatePackage("test_package")
x = myWebPackage.Add(objWebWindow &
"/default.aspx", fpDepsDefault)
Call myWebPackage.Save("c:\test_package.fwp", 1)
End If
End If
Next Folder
Next myWeb
End Sub

--
Thanks!
John Jansen
Microsoft Office FrontPage
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Similar Threads


Top