-
Edit with TextEdit via VBA
I need to call Mac's Text editor ("TextEdit") using the shell command in a VBA project.
I was hoping it would be as simple as:
Shell("TextEdit (mytextfile)")
but there is apparently more to it in Apple.
Any ideas. (The Apple Script editor didn't help much.)
-
This worked for me
[VBA]Dim scriptStr As String
scriptStr = "activate application ""TextEdit"""
scriptStr = scriptStr & vbCr & "set miniaturized of window 1 of application ""Microsoft Excel"" to true"
MacScript (scriptStr)[/VBA]
-
Mike, Thanks. My top question was incomplete. It should have read:
"I need to call Mac's Text editor ("TextEdit") using the shell command in a VBA project and automatically display a specified text file."
It's the second part that is the most critical to my need. Thanks again.
-
[VBA]Sub test()
Dim strScript As String
strScript = strScript & "tell application ""TextEdit"" " & vbCr
strScript = strScript & "open ""Macintosh HD:Users:merickson
ocuments:Lyrics:Roll in my sweet baby's arms (explicit).rtf"" " & vbCr
strScript = strScript & "activate" & vbCr
strScript = strScript & "end tell"
MacScript strScript
AppActivate "TextEdit", True
End Sub
[/VBA]
-
Yessssss!! Perfect. Thanks.
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