Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
frendabrenda1
 
Posts: n/a
Default Address of workbook in a macro

I have an Excel workbook on a netwrok drive that has macros which create
record numbers and copy each record and its data to a specific worksheet in
the file. I am having problems with users copying the file or creating
shortcuts and ending up with duplicate copies of the file which pretty much
destoys the the validity of the records.

I was thinking there might be a way in the macro, rather than say
sheets("records").select I could provide the address of the correct file
like sheets(G:\\Workbook "records").select If the user were not in the
correct network drive version of the workbook, then the macro could not find
the sheet and give an error.

Is there a way to make this work, or any other ideas as to how to stop
copying of the file in any way or set up a file that can be distributed to
everyone that will only open the right file.

Any ideas would be gretly appreciate. Thank you so much!
brenda
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Address of workbook in a macro

Workbooks("MyWorkbook.xls").worksheets("records"). select

HTH
--
AP

"frendabrenda1" a écrit dans le
message de ...
I have an Excel workbook on a netwrok drive that has macros which create
record numbers and copy each record and its data to a specific worksheet

in
the file. I am having problems with users copying the file or creating
shortcuts and ending up with duplicate copies of the file which pretty

much
destoys the the validity of the records.

I was thinking there might be a way in the macro, rather than say
sheets("records").select I could provide the address of the correct

file
like sheets(G:\\Workbook "records").select If the user were not in the
correct network drive version of the workbook, then the macro could not

find
the sheet and give an error.

Is there a way to make this work, or any other ideas as to how to stop
copying of the file in any way or set up a file that can be distributed to
everyone that will only open the right file.

Any ideas would be gretly appreciate. Thank you so much!
brenda



  #3   Report Post  
Posted to microsoft.public.excel.misc
Doug Kanter
 
Posts: n/a
Default Address of workbook in a macro

"frendabrenda1" wrote in message
...

If the user were not in the
correct network drive version of the workbook, then the macro could not
find
the sheet and give an error.


Just make sure you program the exception handling, rather than just let an
"error happen". Know what I mean?


  #4   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Address of workbook in a macro

Doug is right...

Sub test()
Const WBname = "MyWorkbook.xls"
Const WSname = "records"

Dim WB As Workbook
Dim WS As Worksheet
On Error Resume Next
Set WB = Workbooks(WBname)
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & "is not opened"
Exit Sub
End If
on error resume next
Set WS = WB.Worksheets(WSname).Select
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & _
"has no sheet " & WSname
Exit Sub
End If
WB.Select
End Sub

"frendabrenda1" a écrit dans le
message de ...
I have an Excel workbook on a netwrok drive that has macros which create
record numbers and copy each record and its data to a specific worksheet

in
the file. I am having problems with users copying the file or creating
shortcuts and ending up with duplicate copies of the file which pretty

much
destoys the the validity of the records.

I was thinking there might be a way in the macro, rather than say
sheets("records").select I could provide the address of the correct

file
like sheets(G:\\Workbook "records").select If the user were not in the
correct network drive version of the workbook, then the macro could not

find
the sheet and give an error.

Is there a way to make this work, or any other ideas as to how to stop
copying of the file in any way or set up a file that can be distributed to
everyone that will only open the right file.

Any ideas would be gretly appreciate. Thank you so much!
brenda



  #5   Report Post  
Posted to microsoft.public.excel.misc
Doug Kanter
 
Posts: n/a
Default Address of workbook in a macro

"Ardus Petus" wrote in message
...
Doug is right...


Well, that's it for me, until next year. :-)




  #6   Report Post  
Posted to microsoft.public.excel.misc
frendabrenda1
 
Posts: n/a
Default Address of workbook in a macro

I am not sure this answers my real problem. If a user has copied the
original file to their hard drive, then both the correct network file and the
copied hard drive file are called "MyWorkbook.xls". I am trying to find a
way that an error would occur if the user were not on the network drive
version of "MyWorkbook.xls"

Any thougths?

Thank you so much for thinking about this.

Have a GREAT day.

brenda

"Ardus Petus" wrote:

Doug is right...

Sub test()
Const WBname = "MyWorkbook.xls"
Const WSname = "records"

Dim WB As Workbook
Dim WS As Worksheet
On Error Resume Next
Set WB = Workbooks(WBname)
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & "is not opened"
Exit Sub
End If
on error resume next
Set WS = WB.Worksheets(WSname).Select
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & _
"has no sheet " & WSname
Exit Sub
End If
WB.Select
End Sub

"frendabrenda1" a écrit dans le
message de ...
I have an Excel workbook on a netwrok drive that has macros which create
record numbers and copy each record and its data to a specific worksheet

in
the file. I am having problems with users copying the file or creating
shortcuts and ending up with duplicate copies of the file which pretty

much
destoys the the validity of the records.

I was thinking there might be a way in the macro, rather than say
sheets("records").select I could provide the address of the correct

file
like sheets(G:\\Workbook "records").select If the user were not in the
correct network drive version of the workbook, then the macro could not

find
the sheet and give an error.

Is there a way to make this work, or any other ideas as to how to stop
copying of the file in any way or set up a file that can be distributed to
everyone that will only open the right file.

Any ideas would be gretly appreciate. Thank you so much!
brenda




  #7   Report Post  
Posted to microsoft.public.excel.misc
Doug Kanter
 
Posts: n/a
Default Address of workbook in a macro

Brenda, are users supposed to store anything at all on their local drives?
There are a number of ways to address this issue, some from within Excel,
and some via some Windows tricks.


"frendabrenda1" wrote in message
...
I am not sure this answers my real problem. If a user has copied the
original file to their hard drive, then both the correct network file and
the
copied hard drive file are called "MyWorkbook.xls". I am trying to find a
way that an error would occur if the user were not on the network drive
version of "MyWorkbook.xls"

Any thougths?

Thank you so much for thinking about this.

Have a GREAT day.

brenda

"Ardus Petus" wrote:

Doug is right...

Sub test()
Const WBname = "MyWorkbook.xls"
Const WSname = "records"

Dim WB As Workbook
Dim WS As Worksheet
On Error Resume Next
Set WB = Workbooks(WBname)
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & "is not opened"
Exit Sub
End If
on error resume next
Set WS = WB.Worksheets(WSname).Select
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & _
"has no sheet " & WSname
Exit Sub
End If
WB.Select
End Sub

"frendabrenda1" a écrit dans le
message de ...
I have an Excel workbook on a netwrok drive that has macros which
create
record numbers and copy each record and its data to a specific
worksheet

in
the file. I am having problems with users copying the file or creating
shortcuts and ending up with duplicate copies of the file which pretty

much
destoys the the validity of the records.

I was thinking there might be a way in the macro, rather than say
sheets("records").select I could provide the address of the correct

file
like sheets(G:\\Workbook "records").select If the user were not in
the
correct network drive version of the workbook, then the macro could not

find
the sheet and give an error.

Is there a way to make this work, or any other ideas as to how to stop
copying of the file in any way or set up a file that can be distributed
to
everyone that will only open the right file.

Any ideas would be gretly appreciate. Thank you so much!
brenda






  #8   Report Post  
Posted to microsoft.public.excel.misc
frendabrenda1
 
Posts: n/a
Default Address of workbook in a macro

No, there is nothing to be stored on the user's hrd drive.

Thanks again!

brenda

"Doug Kanter" wrote:

Brenda, are users supposed to store anything at all on their local drives?
There are a number of ways to address this issue, some from within Excel,
and some via some Windows tricks.


"frendabrenda1" wrote in message
...
I am not sure this answers my real problem. If a user has copied the
original file to their hard drive, then both the correct network file and
the
copied hard drive file are called "MyWorkbook.xls". I am trying to find a
way that an error would occur if the user were not on the network drive
version of "MyWorkbook.xls"

Any thougths?

Thank you so much for thinking about this.

Have a GREAT day.

brenda

"Ardus Petus" wrote:

Doug is right...

Sub test()
Const WBname = "MyWorkbook.xls"
Const WSname = "records"

Dim WB As Workbook
Dim WS As Worksheet
On Error Resume Next
Set WB = Workbooks(WBname)
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & "is not opened"
Exit Sub
End If
on error resume next
Set WS = WB.Worksheets(WSname).Select
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & _
"has no sheet " & WSname
Exit Sub
End If
WB.Select
End Sub

"frendabrenda1" a écrit dans le
message de ...
I have an Excel workbook on a netwrok drive that has macros which
create
record numbers and copy each record and its data to a specific
worksheet
in
the file. I am having problems with users copying the file or creating
shortcuts and ending up with duplicate copies of the file which pretty
much
destoys the the validity of the records.

I was thinking there might be a way in the macro, rather than say
sheets("records").select I could provide the address of the correct
file
like sheets(G:\\Workbook "records").select If the user were not in
the
correct network drive version of the workbook, then the macro could not
find
the sheet and give an error.

Is there a way to make this work, or any other ideas as to how to stop
copying of the file in any way or set up a file that can be distributed
to
everyone that will only open the right file.

Any ideas would be gretly appreciate. Thank you so much!
brenda






  #9   Report Post  
Posted to microsoft.public.excel.misc
Doug Kanter
 
Posts: n/a
Default Address of workbook in a macro

In that case, you'd be better off having your network administrator prevent
this from happening via mapping and other tricks (most of which I'm not
familiar with). It was done at my home office. When users see their "My
Documents" folders, they're actually in designated folders on the server.

"frendabrenda1" wrote in message
...
No, there is nothing to be stored on the user's hrd drive.

Thanks again!

brenda

"Doug Kanter" wrote:

Brenda, are users supposed to store anything at all on their local
drives?
There are a number of ways to address this issue, some from within Excel,
and some via some Windows tricks.


"frendabrenda1" wrote in
message
...
I am not sure this answers my real problem. If a user has copied the
original file to their hard drive, then both the correct network file
and
the
copied hard drive file are called "MyWorkbook.xls". I am trying to
find a
way that an error would occur if the user were not on the network drive
version of "MyWorkbook.xls"

Any thougths?

Thank you so much for thinking about this.

Have a GREAT day.

brenda

"Ardus Petus" wrote:

Doug is right...

Sub test()
Const WBname = "MyWorkbook.xls"
Const WSname = "records"

Dim WB As Workbook
Dim WS As Worksheet
On Error Resume Next
Set WB = Workbooks(WBname)
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & "is not opened"
Exit Sub
End If
on error resume next
Set WS = WB.Worksheets(WSname).Select
on error goto 0
If WB Is Nothing Then
MsgBox "Workbook " & WBname & vbLf & _
"has no sheet " & WSname
Exit Sub
End If
WB.Select
End Sub

"frendabrenda1" a écrit dans
le
message de ...
I have an Excel workbook on a netwrok drive that has macros which
create
record numbers and copy each record and its data to a specific
worksheet
in
the file. I am having problems with users copying the file or
creating
shortcuts and ending up with duplicate copies of the file which
pretty
much
destoys the the validity of the records.

I was thinking there might be a way in the macro, rather than say
sheets("records").select I could provide the address of the
correct
file
like sheets(G:\\Workbook "records").select If the user were not in
the
correct network drive version of the workbook, then the macro could
not
find
the sheet and give an error.

Is there a way to make this work, or any other ideas as to how to
stop
copying of the file in any way or set up a file that can be
distributed
to
everyone that will only open the right file.

Any ideas would be gretly appreciate. Thank you so much!
brenda








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
Macro to open workbook and copy and paste values in to orig workbo Dena X Excel Worksheet Functions 1 December 15th 05 11:13 PM
Issuing macro in workbook from separate workbook Nigel Excel Discussion (Misc queries) 1 May 16th 05 05:46 PM
run macro on workbook open kevin Excel Discussion (Misc queries) 3 March 4th 05 10:12 AM
Copying a workbook with custom toolbar assigned to a macro Matt W Excel Discussion (Misc queries) 1 February 4th 05 10:46 PM
Problem executing a macro from different workbook where it is Sergio Calleja Excel Discussion (Misc queries) 1 January 17th 05 12:38 PM


All times are GMT +1. The time now is 06:01 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"