
Importing from Excel to Excel using VB.
I have done somthing similar. But I had to import/export csv-files and was just
coding it with vba. (not a real vb-project)
but you could also write a macro in excel and then start it with your
vb-project.
Here is a code-fragment that could be useful for you:
according to your short discription i assume that you have just one sheet in
your excel file. otherwise you have to be careful, in which sheet to copy.
Of course you have to adopt it and create your own variables with your file
names...
(sorry that there is no comment, but the comment i have is german)
greetings Arno
Workbooks.Open FileName:=Path + ToOpenFile
Windows(ToOpenFile).Activate
Worksheets(DialogName + "_" + Trim(Str(FileNumber)) + "_" +
SheetName).Range(myRange).Select
Selection.Copy
Windows(Plain).Activate
Worksheets.Add.Name = SheetName
Worksheets(SheetName).Range(myRange).Select
ActiveSheet.Paste
Selection.Columns.AutoFit
Worksheets(SheetName).Range("A1").Select
Selection.Copy
Windows(ToOpenFile).Close SaveChanges:=False
Quote:
> Hello,
> I have an Excel master documet, Every morning I get 3 excelfiles that I need
> to import som info from into the master.
> I'm interested in making a VB 5 program with to command buttons only
> Update Master and Exit.
> There are only 1 column in each of the 3 files that need to be imported.
> column 3
> I want the master document to be visual if possible.
> Anyone who can get me started with an example.
> regards
> Stein Johannessen
--
Arno Kersche
Neptunweg 4/7
A-9020 Klagenfurt
Austria, Europe
Phone: +43/(0)699/12763818