View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Export Import Modules File Name error

Noemi,

The exported file will have a "bas" extension, not a "das" extension.
Correct the name of the file in the Import statement.

Also, the line of code

Dim vbcomp, vbcomp1, vpcom2, vpcomp3, vpcomp4, vpcomp5 As VBComponent

is not doing what you think it is. It is NOT declaring all the variables as
VBComponent. It declares vbcomp, vbcomp1, vpcom2, vpcomp3, and vpcomp4 as
Variant types, and only vpcomp5 As VBComponent.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)




"Noemi" wrote in message
...
Hi
I have been able to automate the export of module however I am having
problems importing the module.

The following is the code I currently have to Import but when I run it I
get
a file name error and I am not sure why.

Any help would be great.

Public Sub AddModules()
Dim vbproject As vbproject
Dim vbcomp, vbcomp1, vpcom2, vpcomp3, vpcomp4, vpcomp5 As VBComponent
Set vbproject = ThisWorkbook.vbproject
Set vbcomp = ThisWorkbook.vbproject.vbcomponents.Import("G:\Mer ch
Services\Advertising\Macro\Module3.das")
End Sub