Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing workbook after .OpenText


Hi all,

I have the following code in an Excel document:


Code
-------------------
Dim name
Dim fullname
name = Dir(ActiveWorkbook.Path & "\*.csv")
While name < ""
fullname = ActiveWorkbook.Path & "\" & name
MsgBox fullname
Workbooks.OpenText _
Filename:=fullname, _
DataType:=xlDelimited, _
comma:=True

' Some code to go here....
name = Dir
Wen
-------------------


Ok, the problem I have at the moment is that I need to open this cs
file, which is performed fine above into a new workbook. However how d
I then get a 'pointer' to that workbook. I need to be able to perfor
operations on the opened .csv file, and my original workbook, (the on
with the macro in it), and then copy data out of the .csv file into th
original workbook.

I'm guessing it would be something like:

with Workbooks(2).Worksheets(1).... etc, but I don't know how to mak
sure I am talking about the right workbook.

Any ideas?

Thanks,

Phi

--
Phil_
-----------------------------------------------------------------------
Phil_V's Profile: http://www.excelforum.com/member.php...fo&userid=3185
View this thread: http://www.excelforum.com/showthread.php?threadid=52314

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Accessing workbook after .OpenText

You have the name of the workbook in Name

Dim name
Dim fullname
Dim bk as Workbook
name = Dir(ActiveWorkbook.Path & "\*.csv")
While name < ""
fullname = ActiveWorkbook.Path & "\" & name
MsgBox fullname
Workbooks.OpenText _
Filename:=fullname, _
DataType:=xlDelimited, _
comma:=True
set bk = workbooks(name)
' now use bk to refer to the workbook

' Some code to go here....
name = Dir
Wend

--
Regards,
Tom Ogilvy


"Phil_V" wrote:


Hi all,

I have the following code in an Excel document:


Code:
--------------------
Dim name
Dim fullname
name = Dir(ActiveWorkbook.Path & "\*.csv")
While name < ""
fullname = ActiveWorkbook.Path & "\" & name
MsgBox fullname
Workbooks.OpenText _
Filename:=fullname, _
DataType:=xlDelimited, _
comma:=True

' Some code to go here....
name = Dir
Wend
--------------------


Ok, the problem I have at the moment is that I need to open this csv
file, which is performed fine above into a new workbook. However how do
I then get a 'pointer' to that workbook. I need to be able to perform
operations on the opened .csv file, and my original workbook, (the one
with the macro in it), and then copy data out of the .csv file into the
original workbook.

I'm guessing it would be something like:

with Workbooks(2).Worksheets(1).... etc, but I don't know how to make
sure I am talking about the right workbook.

Any ideas?

Thanks,

Phil


--
Phil_V
------------------------------------------------------------------------
Phil_V's Profile: http://www.excelforum.com/member.php...o&userid=31857
View this thread: http://www.excelforum.com/showthread...hreadid=523144


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
opentext method of excel workbook object Kislay Excel Programming 2 May 12th 05 03:56 AM
OpenText Method of Workbook Object Question John Excel Programming 2 October 20th 04 07:39 PM
Accessing workbook info from a different workbook macro Brian Bowman[_3_] Excel Programming 0 September 20th 04 06:09 PM
Accessing workbook info from a different workbook macro Brian Bowman Excel Programming 2 September 16th 04 10:01 PM
After OpenText all pastes from external apps use format from OpenText Jim[_31_] Excel Programming 1 November 8th 03 02:17 AM


All times are GMT +1. The time now is 06:44 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"