Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Accessing Windows clipboard during runtime

Is it possible to access the Clipboard with code during runtime? I would like to clear the clipboard and then paste contents to it.

Here is a sample of my code:

...
...
...
ActiveWorkbook.SaveAs Filename:=strPath & strFileName, FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close False
' Clipboard.Clear
' Clipboard.SetText Format(intDate, "Short Date")
MsgBox "Number of records:" & vbTab & FormatNumber(intLastRow - 1, 0, vbFalse, vbFalse, vbTrue) & vbCrLf & vbCrLf & vbTab & " Date:" & vbTab & Format(intDate, "m-d-yyyy") & vbCrLf & vbCrLf & " File Name:" & vbTab & strFileName, vbOKOnly, "Stats"
End Sub



The Clipboard commands are commented out because whenever I run this, Excel crashes, has to close down, asks to send an error report to MS, and I lose any unsaved data.

I got these commands from a project I was working on in my Programming Fundamentals class. When I looked these commands up in VB6's Object Browser, it said that the command was from the VB Library. I went to References to see what it was using (and their paths). The 2 I thought it could be were "VB Objects & Procedures" and "VB Runtime Objects & Procedures". I tried selecting these references in VBA by browsing to their path. The path for VB O & P was fine and was able to use it okay. But the path for VB Runtime O & P was "C:\WINDOWS\SYSTEM32\msvbvm60.dll\3". First, how do I refer to "\3" of a .dll file. Second, when I tried refering to "C:\WINDOWS\SYSTEM32\msvbvm60.dll" it gave me an error saying "Name conflicts with existing module, project, or object library".

Any help with this would be greatly appreciated,

Conan Kelly
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Accessing Windows clipboard during runtime

I'm not familiar with the technique you're using. Usually Excel developers
just use a DataObject to put something in the clipboard:

Sub a()
Dim MyData As DataObject
Set MyData = New DataObject
MyData.SetText Format(Now, "Short Date")
MyData.PutInClipboard
End Sub

--
Jim
"Conan Kelly" wrote in message
...
Is it possible to access the Clipboard with code during runtime? I would
like to clear the clipboard and then paste contents to it.

Here is a sample of my code:

...
...
...
ActiveWorkbook.SaveAs Filename:=strPath & strFileName,
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close False
' Clipboard.Clear
' Clipboard.SetText Format(intDate, "Short Date")
MsgBox "Number of records:" & vbTab & FormatNumber(intLastRow - 1, 0,
vbFalse, vbFalse, vbTrue) & vbCrLf & vbCrLf & vbTab & " Date:" & vbTab &
Format(intDate, "m-d-yyyy") & vbCrLf & vbCrLf & " File Name:" &
vbTab & strFileName, vbOKOnly, "Stats"
End Sub



The Clipboard commands are commented out because whenever I run this, Excel
crashes, has to close down, asks to send an error report to MS, and I lose
any unsaved data.

I got these commands from a project I was working on in my Programming
Fundamentals class. When I looked these commands up in VB6's Object
Browser, it said that the command was from the VB Library. I went to
References to see what it was using (and their paths). The 2 I thought it
could be were "VB Objects & Procedures" and "VB Runtime Objects &
Procedures". I tried selecting these references in VBA by browsing to their
path. The path for VB O & P was fine and was able to use it okay. But the
path for VB Runtime O & P was "C:\WINDOWS\SYSTEM32\msvbvm60.dll\3". First,
how do I refer to "\3" of a .dll file. Second, when I tried refering to
"C:\WINDOWS\SYSTEM32\msvbvm60.dll" it gave me an error saying "Name
conflicts with existing module, project, or object library".

Any help with this would be greatly appreciated,

Conan Kelly


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Accessing Windows clipboard during runtime

Jim,

Thanks for your help. That worked for what I need to do.

Thanks again,

Conan


"Jim Rech" wrote in message
...
I'm not familiar with the technique you're using. Usually Excel
developers
just use a DataObject to put something in the clipboard:

Sub a()
Dim MyData As DataObject
Set MyData = New DataObject
MyData.SetText Format(Now, "Short Date")
MyData.PutInClipboard
End Sub

--
Jim



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Media Player disables Clipboard in Excel jmaskew Excel Discussion (Misc queries) 0 August 29th 08 01:56 AM
Clipboard empty but still get waring that clipboard is full Steve Excel Discussion (Misc queries) 0 June 17th 08 09:05 PM
Paste contents of windows clipboard into a vba 2d array? Flystar[_16_] Excel Programming 1 May 29th 04 03:18 AM
Copy to windows clipboard BillShut Excel Programming 1 February 6th 04 06:51 PM
Accessing the clipboard after copyface Googleplex Excel Programming 1 December 7th 03 03:55 AM


All times are GMT +1. The time now is 09:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"