When I paste after running my code, there is nothing in the Clipboard to paste.
- Some code concatenates two cell values into a string.
- That string goes to a Data object which is copied to the clipboard
- The next bit of code opens a folder in a Windows Explorer window. I want to manually create the folder (CRTL+SHIFT+N) and paste the string as the name of the folder.
When I use F8 to step through the code, I can confirm that the value is copying to the clipboard properly.
But when I run the code with F5 and manually create the folder, there is nothing there to paste.
I am suspecting that there is something about the (CRTL+SHIFT+N) keystroke that clears the clipboard.
'Looking at the Sheet Name For The Hyperlink Lookup Later
If ActiveSheet.Name = "Submittals" Then
Dim SubName As String
Dim SubFldr As New MSForms.DataObject
LinkType = "Submittal Location"
'Joining the Cell Values to a string
SubName = Cells(Application.ActiveCell.Row, 2).Value & " " & Cells(Application.ActiveCell.Row, 3).Value
MsgBox SubName
SubFldr.SetText Text:=SubName
SubFldr.PutInClipboard
'Looks up link address from elsewhere in the subroutine and stores it to a variable
Link = Application.WorksheetFunction.VLookup(Project, Range("Project_Table"), _
Application.WorksheetFunction.Match(LinkType, Range("Project_Table_Header"), 0) _
, False)
'Opens the Explorer window
ActiveWorkbook.FollowHyperlink Address:=Link
It's at this point that I want to manually create a folder (CRTL+SHIFT+N) and paste the SubFldr value that should be in the clipboard.
If I paste in Notepad or else where before creating the folder, the value is there, and I can reuse it.
If I make the folder and then paste (my ultimate goal), there is nothing to paste.
It's likely obvious from my code that I know just enough to get myself into trouble. There are more efficient ways to do what I'm trying to do