View Single Post
 
Old 09-27-2017, 06:30 AM
StephenRay StephenRay is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default

Ok! It works! I am passing a variable in a Sub like this:

CallingSub
'This part clears the clipboard
Dim clipboard As MSForms.DataObject
Set clipboard = New MSForms.DataObject
clipboard.SetText ""
clipboard.PutInClipboard

If InStr(StrTxt4, "FSA") > 0 Then
Call FSA(clipboard)

And the called sub looks like this:

Sub FSA(clipboard)
'
' FSA Macro
Dim StrTxt9 As String
StrTxt9 = ActiveDocument.Paragraphs(9).Range.Text
.....more code....
End sub

And my question is this. Best Practices say to use a Function rather than a called sub? Is that right? Ok, but whyis a Function best? I don't get it. For development purposes, I got it going just calling a sub.

Thanks
Reply With Quote