View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default opening and referencing another workbook


I need to distribute copies of an Excel workbook to multiple users. On
occassion I may need to update source data for listboxes in their workbook,
so I created a "source data.xls" that I'm putting in a shared directory. I'm
currently trying to write code to check 3 values in their local copy against
"source data.xls", and if any are different, then copy the information from
the related page back to their local workbook to update their source
information.

I'm having some syntax issues when opening my source workbook, and wasn't
able to find anything on google, so here goes;
if you have any suggestions on what I need to do differently to open or
reference the source.xls I'd appreciate any input. Also, I may not be
looking under the right help topics, so I'd also welcome any keywords I
should be using if this information is in the help file somewhere.

Thanks,
Keith

Private Sub GetUpdatedData()
Dim SourceWB As Workbook

'On Error Resume Next
MyVPS = Sheet1.Range("G1").Value
MyVRsons = Sheet1.Range("G2").Value
MyVArds = Sheet1.Range("G3").Value

Set SourceWB = Workbooks.Open("\\Server05\workfiles\Source.xls", False,
True)

CheckVPS = SourceWB.Sheet1.Range("A1").Value 'errors out here
CheckVRsons = SourceWB.Sheet2.Range("A1").Value
CheckVArds = SourceWB.Sheet3.Range("A1").Value

'then use my code to compare them, and eventually to grab any updated data
and copy it over

--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.