LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Fastest way to access information inside a WorkBook

Hi,
I would like to have a tool that allow the user to selected an excel file
and update informations inside the file. The process is in two steps.
1- When you click on a button inside the Form, the user select the file.
When this is done, all the sheets are added to a ListView. The user can
select which sheets he want to copy inside the active workbook. (This work
fine)
2- When the Update button is clicked, the process begin.

At step 1, I want something that is very fast. Opening the workbook is very
long. So , I decided to use function "ListSheet". The problem is that I would
like to add information to monDicoSource. i.e. the "Type" of the sheet. To
know what is the type, I most do a: Sheets(i).Evaluate("Type") Is there a way
to add the type using the following macro or should I open the workbook
inside excel to be able to evaluate it.

At step 2, I open the workbook using standard code. What is the fastest way
to open a workbook, make treatment and close it? Is is to open a new Excel
App and make an Application.Visible = False?
Treatment is: Copy Sheet and Copy some named range value.

Thanks a lot!
Alex

Dim monDicoSource
Function ListSheet(FullPathFile$) As Boolean
Dim Con As Object, Cat As Object, tbl As Object
Dim sTemp As String, c As String, pos As Long
Set Con = CreateObject("ADODB.Connection")
Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" _
& FullPathFile & ";" & "Extended Properties=Excel 8.0;"
Set Cat = CreateObject("ADOX.Catalog")
Set Cat.ActiveConnection = Con
For Each tbl In Cat.Tables
c = tbl.Name
pos = InStrRev(tbl.Name, "$")
If pos = Len(tbl.Name) Then
sTemp = Left$(tbl.Name, pos - 1) 'ou bien, $ CBool est convert
boolean
sTemp = Replace(sTemp, "#", ".")
monDicoSource.Add sTemp, sTemp
End If
Next tbl
Set Cat = Nothing: Con.Close: Set Con = Nothing: Set tbl = Nothing
End Function
--
Alex St-Pierre
 
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
VLOOKUP used with Access DB inside of Excel Sheet Michael Kintner Excel Discussion (Misc queries) 1 February 6th 07 08:44 PM
Run Excel VBA code inside Access [email protected] Excel Discussion (Misc queries) 1 November 18th 06 01:27 AM
EXCEL, VSTO: Fastest way to access multiple cells Peter T Excel Programming 0 June 1st 05 02:51 PM
EXCEL, VSTO: Fastest way to access multiple cells Alan Excel Discussion (Misc queries) 1 June 1st 05 02:45 PM
Preventing opening workbook inside active workbook. Serge[_4_] Excel Programming 2 November 4th 03 07:51 PM


All times are GMT +1. The time now is 06:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"