View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
vba man vba man is offline
external usenet poster
 
Posts: 2
Default passing strings

I know you already have an answer, but it parallels something I do.

My understanding is you are passing a string from one workbook to
another and for some reason you need to use multiple files to do this.

(the result will print in the immediate window after running the second
subroutine.)

Sub save_variable()


st = "string to be passed"

Workbooks.Add
Range("a1") = st

Application.DisplayAlerts = False
'prevents asking if you want to write over old file

ActiveWorkbook.SaveAs ("stringtopass")

ActiveWorkbook.Close


End Sub


Sub get_variable()

Workbooks.Open FileName:="stringtopass"
st = Range("a1")
ActiveWorkbook.Close

Debug.Print "string passed: "; st

End Sub



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!