LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.access.formscoding,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do you capture the name of the current worksheet in VBA?

Paul wrote:
| I'm using Automation to open and populate fields in an Excel workbook
| from Access. The code I'm using is:
|
| Function open_file_in_Excel(strFileSpec As String, intPopulate As
| Integer) Dim appExcel As Excel.Application
| Dim wbk As Excel.Workbook
| Dim wsht As Worksheet
| Set appExcel = CreateObject("Excel.Application")
| Set wbk = appExcel.Workbooks.Open(strFileSpec)
| appExcel.Visible = True
|
| At this point, I've got the workbook open, and I would like to
| capture the name of the Active Worksheet. I've tried various
| combinations like
|
| Set wsht = Workbooks(strFileSpec).ActiveSheet.name
| Set wsht = Application.Workbooks(strFileSpec).ActiveSheet

Set wsht = appExcel.Workbooks(1).ActiveSheet
or:
Set wsht = appExcel.ActiveSheet

--
KN


 
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
Capture Worksheet Change Value Risky Dave Excel Programming 1 January 6th 09 06:43 PM
In a range of months can I capture the most current month entry? Karlene Excel Discussion (Misc queries) 4 August 15th 07 05:55 PM
Capture current WS Name? Dave Birley Excel Programming 5 May 8th 07 05:09 PM
Capture a worksheet in VBA Madiya Excel Programming 6 August 11th 06 03:40 PM
Capture Current Selection in a Combo Box Randy[_10_] Excel Programming 3 August 6th 04 09:43 PM


All times are GMT +1. The time now is 06:51 AM.

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"