Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is .OpenTest
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is .OpenTest
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is .OpenTest
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is .OpenTest
Hey Dave,
This is embarrassing, it was indeed ".OpenText". I was mistaken, sorry for the post. -Minitman On Mon, 25 Aug 2008 16:32:15 -0500, 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
What is .OpenTest
Thanks Dave,
That works for me. -Minitman On Mon, 25 Aug 2008 16:44:58 -0500, Dave Peterson wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|