#1
|
|||
|
|||
Pass variables to the 'EditPaste' sub
I have a subroutine that is executed when pressing CTRL-V (paste function). It's called 'EditPaste'.
I also have a second subroutine from which I need to make a call to the 'EditPaste' sub. With this call, I need to pass a variable from this second sub to the 'EditPaste' sub. For more clarity, here's the code... Code:
Sub EditPaste(variable) 'code here... End Sub Code:
Sub second_subroutine Call EditPaste("value") End Sub The problem is that the 'EditPaste' sub will no longer execute when pressing the CTRL+V key combination. So it executes well when using the 'Sub EditPaste' code, but not at all when using the 'Sub EditPaste(variable)' code. How can I pass variables to 'EditPaste' and be able to execute it with CTRL+V at the same time? Alex |
#2
|
|||
|
|||
Code:
Sub EditPaste() MyEditPaste End Sub Sub MyEditPaste(Optional varPassed As String) If Not varPassed = vbNullString Then MsgBox varPassed Else Selection.Paste End If End Sub Sub OtherRoutine() MyEditPaste "Test" End Sub |
#3
|
|||
|
|||
Works great, thank you!
Alex |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I pass a field as a parameter via a URL? | kelvinlewisuk1 | Outlook | 0 | 06-30-2016 08:30 AM |
Array to iterate through variables and trap blank variables | Marrick13 | Word VBA | 5 | 08-04-2015 06:19 AM |
can word: make variables, find appropriate pages, fill out pages with variables, print only those | 20GT | Word VBA | 1 | 10-15-2014 09:48 PM |
How to Pass Document to this Sub | ilcaa72 | Word VBA | 1 | 01-28-2014 03:04 PM |
How to pass parameters to a .msg file? | HereNow | Outlook | 0 | 11-05-2012 10:38 AM |