What is .OpenTest
Dim TestWkbk as workbook
set testwkbk = nothing
on error resume next
set testwkbk = workbooks("somenamehere.xls") 'no drive, no path!
on error goto 0
if testwkbk is nothing then
'not open
'open it???
set testwkbk = workbooks.open(Filename:="c:\yourpath\somenamehere .xls")
end if
msgbox testwkbk.worksheets(1).range("a1").text
Minitman wrote:
Hey Dave,
Thanks for the reply.
I didn't consider a typo in MS help - I mean Micro$oft NEVER makes
mistakes, right? <VBG
I was looking for a simple way to see if a workbook was open, I
thought maybe this was it - silly me.
-Minitman
On Mon, 25 Aug 2008 16:02:19 -0500, Dave Peterson
wrote:
I bet it's a typo and should be .openteXt (text, not test).
I'd use it like:
Option Explicit
Sub Testme01()
Dim myFileName As Variant
Dim wb as workbook 'not workbooks -- with an S
myFileName = Application.GetOpenFilename(filefilter:="Text Files, *.Txt", _
Title:="Pick a File")
If myFileName = False Then
MsgBox "Ok, try later" 'user hit cancel
Exit Sub
End If
Workbooks.OpenText Filename:=myFileName
set wb = activeworkbook
'...code that does something.
End Sub
Minitman wrote:
Greetings,
I was setting a variable called "wb" to be the temporary name of the
current Workbook I needed to open (once opened, I returned the value
of wb to vbNullString). I had dimmed this "wb" as Workbooks. I was
trying to see if it was working (It was not but that has been fixed)
by using a MsgBox asking for wb.Name. ",Name" was not available! But
as I was scrolling though what was available, I came across
".OpenTest". When I tried to find information in MS Help there was
nothing. I then went to the original setting for "wb"
Set wb = WorkBooks(MCL.xls)
and tried to attach ".OpenTest" there and it was not available.
Anyone know what ".OpenTest" does and how to use it?
Any information would be appreciated.
-Minitman
--
Dave Peterson
|