LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default How do you get the selection in the VBE Active window

Hi Mike,

Interesting exercise.

XL2007 Visual basic Help searched under "Item Method (VBA Add-In Object
Model)" says CodePanes No unique string associated with this collection.

So it appears that you cannot replace the index number with a string.

I tested like this:-

Sub TestGetSelection()

Dim startline As Long
Dim startcol As Long
Dim endline As Long
Dim endcol As Long
Dim i As Long

For i = 1 To Application.VBE.CodePanes.Count
If Application.VBE.CodePanes(i).CodeModule = "Module2" Then
Exit For
End If
Next i

Application.VBE.CodePanes(i).GetSelection _
startline, startcol, endline, endcol

MsgBox Application.VBE.CodePanes(i) _
.CodeModule & vbCrLf & _
"startline = " & startline & vbCrLf & _
"startcol = " & startcol & vbCrLf & _
"endline = " & endline & vbCrLf & _
"endcol = " & endcol

End Sub

--
Regards,

OssieMac


 
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
refer to active window when more than one window open for a file mcambrose Excel Programming 4 November 17th 08 08:16 PM
Window not active on Auto_Open Steven Excel Programming 2 April 7th 08 11:46 AM
Go to Last Active Window Steven Excel Programming 4 March 6th 08 06:20 PM
How to Active Window maperalia Excel Programming 5 July 13th 07 03:56 PM
active window Gerry Excel Programming 2 December 17th 04 03:33 PM


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