Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Export Import Modules File Name error
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Export Import Modules File Name error
Hi Chip
Thanks for the info. Would you happen to know why the remove module code doesn't work until your program stops running. What I mean is the removing of a module is required before the workbook is email however the modules are not removed when I open up the emailed workbook. Is there a way around to make sure it does perform the task of removing the modules. Thanks Noemi "Chip Pearson" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cannot show, import, export userform: error &H80004005 / component is not corretly installed | Excel Programming | |||
VBA Excel: Can't show, import or export userforms (error: &H800040 | Excel Programming | |||
How do I import text file, analyze data, export results, open next file | Excel Programming | |||
Export / Import to / from Text file | Excel Programming | |||
Import/Export Text File Tab Delimiter | Excel Programming |