Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to fatch Range's from an excel sheet when the file is on netwo

hi All
i write a function to find the Ranges in excel sheet.My excel sheet
shoul be on network. i map that path from my local machine.
now when we publish my site a want to find the range of that excel sheet it
shows " Object variable or with Block bariable not set."




Tthis is my function--where Filename -Z:\inventory.xls, Z:\ is my map Drived
from server.



Friend Function GetExcelRange(ByVal Filename As String)

Dim ExcelAPP As Object
Dim inc As Integer = 0
Dim RangeString As New StringBuilder
Try
ExcelAPP = CreateObject("Excel.Application")
ExcelWorkBook = ExcelAPP.Workbooks.Open(Filename:=Filename)
ExcelSheet = ExcelWorkBook.Worksheets
If ExcelWorkBook.Names.Count = 0 Then
MsgBox("Error: No name ranges in this excel file",
MsgBoxStyle.Critical, "Metamation")
Return RangeString.ToString()
End If
While Not inc = ExcelWorkBook.Names.Count
If inc = 0 Then
RangeString.Append(ExcelWorkBook.Names.Item(inc + 1).Name)
Else
RangeString.Append("," & ExcelWorkBook.Names.Item(inc +
1).Name)
End If

inc += 1
End While

Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Metamation")
Finally
ExcelAPP.ActiveWorkbook.Close()
ExcelAPP.Quit()
ExcelAPP = Nothing
End Try

Return RangeString.ToString()
End Function
Reply
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
Need to link PDF file into excel document for someone not on netwo mizzouali Excel Discussion (Misc queries) 1 January 29th 08 08:20 PM
How can I copy range's style to another in Excel? ZeroCool127 Excel Programming 4 July 20th 06 09:13 AM
questions regarding range's trav Excel Discussion (Misc queries) 3 February 24th 06 06:06 PM
questions regarding range's trav Excel Discussion (Misc queries) 0 February 23rd 06 11:01 PM
how is possible working on work sheet by two person in the netwo. Ben Excel Worksheet Functions 1 November 18th 04 02:39 AM


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

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

About Us

"It's about Microsoft Excel"