ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   passing strings (https://www.excelbanter.com/excel-programming/285968-re-passing-strings.html)

vba man

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!


All times are GMT +1. The time now is 09:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com