Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot show, import, export userform: error &H80004005 / component is not corretly installed danieldc Excel Programming 2 November 25th 05 12:59 PM
VBA Excel: Can't show, import or export userforms (error: &H800040 Daniel Excel Programming 2 November 22nd 05 05:36 PM
How do I import text file, analyze data, export results, open next file Geoffro Excel Programming 2 March 6th 05 08:02 PM
Export / Import to / from Text file C_Ascheman Excel Programming 6 February 22nd 05 11:49 PM
Import/Export Text File Tab Delimiter Cool Sport Excel Programming 3 December 20th 04 12:22 PM


All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"