How to get the number of Line/Column used in Excel sheet ?

  • Thread starter Thread starter bbnimda
  • Start date Start date
B

bbnimda

Hi All,

I'm using a VbScript for Outlook , and want to get informations about Excel
file (Number of line and Column used)

Tks
 
Off the top

Dim XLApp As Object
Dim XLWB as Object
Dim NumRows As Long
Dim NumCols As Long

Set XLApp = CreateObject(Excel.Application")
Set XLWB = Workbooks.Open(Filename:="C:\test\filename.xls")

NumRows = XLWB.Worksheets(1).UsedRange.Rows.Count
NumCols = XLWB.Worksheets(1).UsedRange.Columns.Count

Set XLWB = Nothing
Set XLApp = Nothing

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Hello Bob,

Great tks

Bye


Bob Phillips said:
Off the top

Dim XLApp As Object
Dim XLWB as Object
Dim NumRows As Long
Dim NumCols As Long

Set XLApp = CreateObject(Excel.Application")
Set XLWB = Workbooks.Open(Filename:="C:\test\filename.xls")

NumRows = XLWB.Worksheets(1).UsedRange.Rows.Count
NumCols = XLWB.Worksheets(1).UsedRange.Columns.Count

Set XLWB = Nothing
Set XLApp = Nothing

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top