PC Review


Reply
Thread Tools Rate Thread

Change link-source on file after copy the sheet into new a newworkbook

 
 
johan
Guest
Posts: n/a
 
      28th Oct 2009
Hello,

I like to have 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.

Why this action.... because my file has buttons on it. When I copy
the sheet with the buttons on it, it will get "links" to the original
file because of the VBA codes on it.

Possible ?? or another solution ?

greetings from John
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      28th Oct 2009
I'm not sure what your buttons do, but you may want to replace the buttons from
the Forms toolbar with commandbuttons from the control toolbox toolbar.

You'll have to move the code (and modify it (probably)) to make it work. But
since the commandbutton's code is within the sheet module that owns the
commandbutton, it'll be copied when the sheet is copied.



johan wrote:
>
> Hello,
>
> I like to have 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.
>
> Why this action.... because my file has buttons on it. When I copy
> the sheet with the buttons on it, it will get "links" to the original
> file because of the VBA codes on it.
>
> Possible ?? or another solution ?
>
> greetings from John


--

Dave Peterson
 
Reply With Quote
 
johan
Guest
Posts: n/a
 
      28th Oct 2009
Hoi,

I'm using Excell 2003.
I'd made a worksheet with on it a couple of buttons created by the
menu-option view -> toolbars -> forms -> button and then linked to the
module which is written in the VBA screen of the sheet known as
"microsoft excel objects" -> Sheet1(template).

When I copy the sheet as written before (select sheettab -> left mouse
button -> create copy -> To new book) then the complete sheet
inclusive the buttons are copied to a new file. This works oke. In
this new file also the VBA code is copied with it. So this is also
oke.

But,... the buttons refers not to the VBA code in this new workbook,
but refers to the VBA code in the original file. Now you have a "link"
as you can see by menu-option Edit -> Links.

Now it is possible to solve the problem by hand:
or- 1) relink the buttons to the correct VBA code in this new file
(select the button -> left mousebutton -> assign macro -> select the
code within this copied workbook).
or- 2) save this new workbook, don't close it, and then go to menu-
option edit -> links -> change source and select this file.

My wish is to get a solution automatic. I wish to copy the worksheet
into a new workbook, save the file as mentioned before: "Template-date-
time.xls" (date and time as actual). and fulfill the menu-option edit
-> links -> change source and select this file.

hopely somebody can give me the solution.

regards,
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      28th Oct 2009
I understood.

Did you reject the other suggestion?

johan wrote:
>
> Hoi,
>
> I'm using Excell 2003.
> I'd made a worksheet with on it a couple of buttons created by the
> menu-option view -> toolbars -> forms -> button and then linked to the
> module which is written in the VBA screen of the sheet known as
> "microsoft excel objects" -> Sheet1(template).
>
> When I copy the sheet as written before (select sheettab -> left mouse
> button -> create copy -> To new book) then the complete sheet
> inclusive the buttons are copied to a new file. This works oke. In
> this new file also the VBA code is copied with it. So this is also
> oke.
>
> But,... the buttons refers not to the VBA code in this new workbook,
> but refers to the VBA code in the original file. Now you have a "link"
> as you can see by menu-option Edit -> Links.
>
> Now it is possible to solve the problem by hand:
> or- 1) relink the buttons to the correct VBA code in this new file
> (select the button -> left mousebutton -> assign macro -> select the
> code within this copied workbook).
> or- 2) save this new workbook, don't close it, and then go to menu-
> option edit -> links -> change source and select this file.
>
> My wish is to get a solution automatic. I wish to copy the worksheet
> into a new workbook, save the file as mentioned before: "Template-date-
> time.xls" (date and time as actual). and fulfill the menu-option edit
> -> links -> change source and select this file.
>
> hopely somebody can give me the solution.
>
> regards,


--

Dave Peterson
 
Reply With Quote
 
johan
Guest
Posts: n/a
 
      29th Oct 2009
Dave,
I'm sorry. I didn't understood the first part of the description.
Now I'm understand it (use of embedded buttons) and....... it works
oke. No links anymore after copying the sheet into a new workbook.
This is really a simple solution.
THANKS.

regards,
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      29th Oct 2009
There are benefits to each kind of button/commandbutton. And problems with
each, too.

But in your case, it just seemed to scream out for the commandbutton suggestion.

Glad it worked for you.

johan wrote:
>
> Dave,
> I'm sorry. I didn't understood the first part of the description.
> Now I'm understand it (use of embedded buttons) and....... it works
> oke. No links anymore after copying the sheet into a new workbook.
> This is really a simple solution.
> THANKS.
>
> regards,


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto copy cell data from source sheet to another wrkbook sheet IVLUTA Microsoft Excel Programming 2 2nd Jun 2009 05:07 PM
Merge 7 files to 1 workbook/7Sheets and then 1 sheet of the newworkbook Snailspace Microsoft Excel Programming 3 7th Aug 2008 01:33 AM
How change link source in long formula when source moved =?Utf-8?B?SXJpbmE=?= Microsoft Excel Programming 4 28th Jun 2006 07:27 AM
How to copy a sheet and rename it with the value of two cells from the source sheet? Simon Lloyd Microsoft Excel Programming 0 12th May 2006 01:31 AM
Change Source of Link in Protected Sheet =?Utf-8?B?Q2hpa3U=?= Microsoft Excel Misc 0 22nd Dec 2005 06:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:26 AM.