|
-
Sep 4th, 2012, 06:34 AM
#4
Re: Using variables from a called macro
It's still not working, presumably because the Word macro has an End statement causing the variables to be forgotten
as long as you return the result before closing the document, it should work fine
declaring variables as public in the thisworkbook code module would work, but it would need the variables to be declared in each document, which may be a problem, so you would have to try declaring them in the template that is used by the opened document
alternatively you can save your variables values to any form of storage and retrieve by excel
or you might even be able to automate the workbook from your word macro to place the values directly in the cells
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|