Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exporting modules (Win98 / Word97 NL)

    I wrote a routine to export all the modules of a VBA project:

    Sub ExportModules()

    Dim strTemp As String
    Dim vbc As Object

    For Each vbc In Application.VBE.VBProjects("Name").VBComponents
    With vbc
    strTemp = .Name
    Select Case .Type
    Case 2, 100 ' ClassModule
    strTemp = strTemp & ".cls"
    Case 3 ' MSForm
    strTemp = strTemp & ".frm"
    Case 1 ' StdModule
    strTemp = strTemp & ".bas"
    Case Else ' Unknown
    strTemp = strTemp & ".jan"
    End Select
    .Export "<path>" & strTemp
    End With
    Next vbc
    End Sub

    This works fine if <path> is a folder on a local hard drive. But if <path> is a folder on a (mapped) network volume then nothing seems to happen; the designated folder (which exists) is still empty after running this Sub. To bad, because now I have to copy the modules to a network location myself in order for a co-worker to import whatever (s)he wants.

    Added
    The initial test-dot did not contain forms. A second test with a dot that contains 4 forms shows that cls and bas modules are not saved to a network location, but frm modules are! <img src=/S/confused3.gif border=0 alt=confused3 width=45 height=45>

    Any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Exporting modules (Win98 / Word97 NL)

    I'm not aware of any restrictions in this respect. Can you try exporting a single module like this, with the appropriate path and names substituted?

    ApplicationVBE.VBProjects("MyTemplateProject").VBC omponents("MyModule").Export "F:MyFolderMyModule.bas"

    or

    ApplicationVBE.VBProjects("MyTemplateProject").VBC omponents("MyModule").Export "servershareMyFolderMy DocumentsMyModule.bas"

  3. #3
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Exporting modules (Win98 / Word97 NL)

    Hi Hans,

    The first method you described didn't, but the second did work for all modules! So problem solved. <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    But i'm still puzzled by the fact that cls & bas modules aren't saved using my method and frm modules are!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Exporting modules (Win98 / Word97 NL)

    I'm glad your problem is solved. I can't explain why standard and class modules are not saved to a path with a drive letter on your system.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •