Exel VBA - Clearing clipboard, area names

T

Timse

Hi!

I'm just a rookie with VBA so don't get mad if I'm asking obviou
questions here.

Microsoft Excel-2000

1) I have a problem with writing a VBA code which would clear all th
clipboard. Othervise I have broblems with these dialog boxes which ar
asking to save or not to save clipboard.

2) I have also an other question about giving names to ranges in VB
code. If i have celected a cell with a function, so that's not
constant, how can I give the name for the cell/ range? I tried this bu
it didn't work:

Selection.Names.Add Name:="name
 
P

papou

1) Code from ?
Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As
Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Declare Function EmptyClipBoard Lib "user32" Alias "EmptyClipboard"
() As Long
Sub EmptyClipBoard()
OpenClipboard (0&)
EmptyClipBoard
CloseClipboard
End Sub
2)
ActiveWorkbook.Names.Add "Name", Selection.Address

HTH
Regards
Pascal
 
P

papou

Please change
Sub EmptyClipBoard()
To
Sub EmptyTheClipBoard()

Apologies
Regards
Pascal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top