ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Exel VBA - Clearing clipboard, area names (https://www.excelbanter.com/excel-programming/301151-exel-vba-clearing-clipboard-area-names.html)

Timse

Exel VBA - Clearing clipboard, area names
 
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

--
Message posted from http://www.ExcelForum.com


Papou

Exel VBA - Clearing clipboard, area names
 
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

"Timse " a écrit dans le message de
...
Hi!

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

Microsoft Excel-2000

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

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

Selection.Names.Add Name:="name"


---
Message posted from http://www.ExcelForum.com/




Papou

Exel VBA - Clearing clipboard, area names
 
Please change
Sub EmptyClipBoard()
To
Sub EmptyTheClipBoard()

Apologies
Regards
Pascal

"Timse " a écrit dans le message de
...
Hi!

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

Microsoft Excel-2000

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

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

Selection.Names.Add Name:="name"


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com