ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help transfering code. (https://www.excelbanter.com/excel-programming/388202-help-transfering-code.html)

C_Ascheman[_2_]

Help transfering code.
 
On my desktop I have a master excel file. It contains code in ThisWorkbook,
SHeet1, Sheet2, Sheet3, Sheet4, Sheet5, and Sheet6. In a folder called excel
on the server (F:\excel) are 6 more simular excel files named Test1 through
Test6. The code contained within those files are almost exactly like the
master except 1 line. For months now I have been trying to figure out a way
to transfer all the code from the master file (code from all sheets and
ThisWorkbook) to each of the files in the excel folder.
In other words transfering the code from Thisworkbook in the master record
on my desktop to the ThisWorkbook of every file in the excel folder on the
server. Not just ThisWorkbook though. I need it to do this for every sheet
from the master file to every file in the excel folder, but only if I push a
button I setup in the master file to call the code needed.
As I have said I have been working on this for several months now, and I am
at a complete loss as to what I need to do to complete this. Please help as I
am now starting to realize this may be a bit out of my skill range.

Thanks
C_Ascheman

FSt1

Help transfering code.
 
hi
set this site...
http://cpearson.com/excel/vbe.htm

regards
FSt1

"C_Ascheman" wrote:

On my desktop I have a master excel file. It contains code in ThisWorkbook,
SHeet1, Sheet2, Sheet3, Sheet4, Sheet5, and Sheet6. In a folder called excel
on the server (F:\excel) are 6 more simular excel files named Test1 through
Test6. The code contained within those files are almost exactly like the
master except 1 line. For months now I have been trying to figure out a way
to transfer all the code from the master file (code from all sheets and
ThisWorkbook) to each of the files in the excel folder.
In other words transfering the code from Thisworkbook in the master record
on my desktop to the ThisWorkbook of every file in the excel folder on the
server. Not just ThisWorkbook though. I need it to do this for every sheet
from the master file to every file in the excel folder, but only if I push a
button I setup in the master file to call the code needed.
As I have said I have been working on this for several months now, and I am
at a complete loss as to what I need to do to complete this. Please help as I
am now starting to realize this may be a bit out of my skill range.

Thanks
C_Ascheman


C_Ascheman[_2_]

Help transfering code.
 
Thanks for the answer FSt1. I have been trying to use this site for sometime
now. Particularly the copying modules between projects section. I have tried
to figure out how to recode the CopyAllModules() to do what I need, but like
I said my skills just are not up to par with whats needed I guess as its been
almost 6 months I have been attempting to do this on my own without any
results. Here is the code I have:

Dim FName As String
Dim VBComp As VBIDE.VBComponent

With Workbooks("Proposal&Acceptance3")
FName = "F:\excel" & "\code.txt"
If Dir(FName) < "" Then
Kill FName
End If
For Each VBComp In .VBProject.VBComponents
If VBComp.Type < vbext_ct_Document Then
VBComp.Export FName
Workbooks("Test1").VBProject.VBComponents.Import FName
Kill FName
End If
Next VBComp
End With

The problem I have is I just can not seem to figure this one out. I need
this to import the ThisWorkbook and all the Sheets from the master workbook
to all workbooks contained in the excel folder on F. At a complete loss as to
what I need to do to get this to work as needed.
Thanks for the help so far.
C_Ascheman

"FSt1" wrote:

hi
set this site...
http://cpearson.com/excel/vbe.htm

regards
FSt1

"C_Ascheman" wrote:

On my desktop I have a master excel file. It contains code in ThisWorkbook,
SHeet1, Sheet2, Sheet3, Sheet4, Sheet5, and Sheet6. In a folder called excel
on the server (F:\excel) are 6 more simular excel files named Test1 through
Test6. The code contained within those files are almost exactly like the
master except 1 line. For months now I have been trying to figure out a way
to transfer all the code from the master file (code from all sheets and
ThisWorkbook) to each of the files in the excel folder.
In other words transfering the code from Thisworkbook in the master record
on my desktop to the ThisWorkbook of every file in the excel folder on the
server. Not just ThisWorkbook though. I need it to do this for every sheet
from the master file to every file in the excel folder, but only if I push a
button I setup in the master file to call the code needed.
As I have said I have been working on this for several months now, and I am
at a complete loss as to what I need to do to complete this. Please help as I
am now starting to realize this may be a bit out of my skill range.

Thanks
C_Ascheman



All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com