Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to enable "Links" when copy a worksheet (with buttons on it) to anew book
Hoi,
I'd created a simple worksheet in Excell with two buttons one it which are related to a VBA code archived in the VBA screen of the worksheet. I made a copy of my worksheet (select worksheet tab - right mouse button - option Move/Copy - Create copy to new workbook). Now I see that my copied file has links (menubar - Edit - Links) to my orinal file. This has to do with the buttons on it. When I delete the buttons in the original file and then I made a copy, no links in the copied file exist. How can I make a copy of a file, with still the buttons on it, but without a link to the original one. Perhaps a new button with a VBA code that copies the file and links directly the buttons to the new file name ?? or...... is there another solution to skip this problem ? regards, Johan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to enable "Links" when copy a worksheet (with buttons on it) t
Try something like this
Sub CopyWorksheet() Dim myWB As Excel.Workbook Dim myShape As Excel.Shape Dim i As Long Dim myWS As Excel.Worksheet Dim myNewWS As Excel.Worksheet Set myWB = ThisWorkbook Set myWS = myWB.Worksheets("Sheet1") '<~~~can change as needed myWS.Copy Set myNewWS = ActiveSheet For i = myNewWS.Shapes.Count To 1 Step -1 Set myShape = myNewWS.Shapes(i) myShape.Delete Next i End Sub HTH, Barb Reinhardt "johan" wrote: Hoi, I'd created a simple worksheet in Excell with two buttons one it which are related to a VBA code archived in the VBA screen of the worksheet. I made a copy of my worksheet (select worksheet tab - right mouse button - option Move/Copy - Create copy to new workbook). Now I see that my copied file has links (menubar - Edit - Links) to my orinal file. This has to do with the buttons on it. When I delete the buttons in the original file and then I made a copy, no links in the copied file exist. How can I make a copy of a file, with still the buttons on it, but without a link to the original one. Perhaps a new button with a VBA code that copies the file and links directly the buttons to the new file name ?? or...... is there another solution to skip this problem ? regards, Johan . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to enable "Links" when copy a worksheet (with buttons on it)t
Thanks for the respons,
I'd tried the solution, but it copies the file without the buttons on it and still with "links" (when looking by menuoption "edit - links". I want to try another solution as describe below. Can somebody please help me out. I need a macro that made a copy of the actual sheet into a new workbook (create a copy - new book). Then the macro has to save directly the file into the directory C:/ Apps with the name "Template-date-time.xls" (date and time as actual). After that the action should be taken: menuaction "Edit - Links - Change Source" and then change the source to the before saved filename. Then the file has, after copy the sheet with the buttons no "links" anymore to the original file. Possible ?? or another solution ? regards, Johan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"_Fill" and "_Key1" is contained in the worksheet I want to copy.. | Excel Discussion (Misc queries) | |||
How do i disable/enable "Worksheet Move or copy" option? | Excel Worksheet Functions | |||
Copy unsaved worksheet "Book" to a Saved workfile | Excel Worksheet Functions | |||
create links to check boxes marked "good" fair"and "bad" | Excel Worksheet Functions | |||
I would like to copy & "paste special" an entire book | Excel Worksheet Functions |