PC Review


Reply
Thread Tools Rate Thread

I can't figure out the correct syntax for referencing a workbook.

 
 
Dave Marden
Guest
Posts: n/a
 
      15th Jan 2007
I have decided to incorporate this change into all upcoming versions of
my program. This has brought up a new problem. "Set bk =
Workbooks(wbName)" works fine for referencing the filename so I tried to use
the same idea but for some reason it always gives me a "runtime error 9"
"Subscript out of range" error. I simply used bk2 for doing this. I
figured I didn't need the error checking since this file is obviously going
to be already running. Any other way of referencing this or am I missing
something here?

Public Sub cmdPullDataFromOldFile_Click()
Dim wbName As String, bk As Workbook
Dim bk2 As Workbook
wbName = Application.GetOpenFilename
wbName2 = ActiveWorkbook.FullName
set bk2 = Workbooks(wbName2)
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Are you sure you want to copy all user input data from " & wbName
& " to this file?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Confirm Data Update" ' Define title.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
Dim bClosed As Boolean
On Error Resume Next
Set bk = Workbooks(wbName)
On Error GoTo 0
If bk Is Nothing Then
bClosed = True
Set bk = Workbooks.Open(wbName)
End If
'Getting Data From Old Version
'Handicap
bk2.Worksheets("Competitors A-Z").Range("D29") =
bk.Worksheets("Competitors A-Z").Range("D29")
'Archery League Name
bk2.Worksheets("League's Score Board").Range("ArcheryLeagueName") =
bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
'Max Make-Up Scores
bk2.Worksheets("Competitors A-Z").Range("MaxMakeupScores") =
bk.Worksheets("Competitors A-Z").Range("MaxMakeupScores")
'Names
bk2.Worksheets("Competitors A-Z").Range("X4:X27").Value =
bk.Worksheets("Competitors A-Z").Range("X4:X27").Value
'Scores, X-Counts, Make-Up, and Blind Data
bk2.Worksheets("Competitors A-Z").Range("AB4:BK27").Value =
bk.Worksheets("Competitors A-Z").Range("AB4:BK27").Value
If bClosed Then bk.Close Savechanges:=False
Else ' User chose No.
MsgBox "You Have Chosen Not To Update This File With Another Files
Data"
End If
End Sub

Any help appreciated,
Dave Marden



 
Reply With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      15th Jan 2007
this is a personal preference, but, if you're not an employee of microsoft, i
really wish you didn't use @microsoft.com in your email address. use
(E-Mail Removed).


--


Gary


"Dave Marden" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have decided to incorporate this change into all upcoming versions of my
> program. This has brought up a new problem. "Set bk = Workbooks(wbName)"
> works fine for referencing the filename so I tried to use the same idea but
> for some reason it always gives me a "runtime error 9" "Subscript out of
> range" error. I simply used bk2 for doing this. I figured I didn't need the
> error checking since this file is obviously going to be already running. Any
> other way of referencing this or am I missing something here?
>
> Public Sub cmdPullDataFromOldFile_Click()
> Dim wbName As String, bk As Workbook
> Dim bk2 As Workbook
> wbName = Application.GetOpenFilename
> wbName2 = ActiveWorkbook.FullName
> set bk2 = Workbooks(wbName2)
> Dim Msg, Style, Title, Help, Ctxt, Response, MyString
> Msg = "Are you sure you want to copy all user input data from " & wbName
> & " to this file?" ' Define message.
> Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
> Title = "Confirm Data Update" ' Define title.
> Response = MsgBox(Msg, Style, Title, Help, Ctxt)
> If Response = vbYes Then ' User chose Yes.
> Dim bClosed As Boolean
> On Error Resume Next
> Set bk = Workbooks(wbName)
> On Error GoTo 0
> If bk Is Nothing Then
> bClosed = True
> Set bk = Workbooks.Open(wbName)
> End If
> 'Getting Data From Old Version
> 'Handicap
> bk2.Worksheets("Competitors A-Z").Range("D29") =
> bk.Worksheets("Competitors A-Z").Range("D29")
> 'Archery League Name
> bk2.Worksheets("League's Score Board").Range("ArcheryLeagueName") =
> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
> 'Max Make-Up Scores
> bk2.Worksheets("Competitors A-Z").Range("MaxMakeupScores") =
> bk.Worksheets("Competitors A-Z").Range("MaxMakeupScores")
> 'Names
> bk2.Worksheets("Competitors A-Z").Range("X4:X27").Value =
> bk.Worksheets("Competitors A-Z").Range("X4:X27").Value
> 'Scores, X-Counts, Make-Up, and Blind Data
> bk2.Worksheets("Competitors A-Z").Range("AB4:BK27").Value =
> bk.Worksheets("Competitors A-Z").Range("AB4:BK27").Value
> If bClosed Then bk.Close Savechanges:=False
> Else ' User chose No.
> MsgBox "You Have Chosen Not To Update This File With Another Files
> Data"
> End If
> End Sub
>
> Any help appreciated,
> Dave Marden
>
>
>



 
Reply With Quote
 
Dave Marden
Guest
Posts: n/a
 
      15th Jan 2007
I guess I didn't realize this would be a problem, they simply say ue an
email address like (E-Mail Removed) so that is exactly what I used. I
have posted on here several times in the past and your the first person I've
ever had say that. I guess I would like to know waht others think about it.
I assume that microsoft doesn't actually use that email address.

Dave Marden

"Gary Keramidas" <GKeramidasATmsn.com> wrote in message
news:(E-Mail Removed)...
> this is a personal preference, but, if you're not an employee of
> microsoft, i
> really wish you didn't use @microsoft.com in your email address. use
> (E-Mail Removed).
>
>
> --
>
>
> Gary
>
>
> "Dave Marden" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I have decided to incorporate this change into all upcoming versions
>> of my program. This has brought up a new problem. "Set bk =
>> Workbooks(wbName)" works fine for referencing the filename so I tried to
>> use the same idea but for some reason it always gives me a "runtime error
>> 9" "Subscript out of range" error. I simply used bk2 for doing this. I
>> figured I didn't need the error checking since this file is obviously
>> going to be already running. Any other way of referencing this or am I
>> missing something here?
>>
>> Public Sub cmdPullDataFromOldFile_Click()
>> Dim wbName As String, bk As Workbook
>> Dim bk2 As Workbook
>> wbName = Application.GetOpenFilename
>> wbName2 = ActiveWorkbook.FullName
>> set bk2 = Workbooks(wbName2)
>> Dim Msg, Style, Title, Help, Ctxt, Response, MyString
>> Msg = "Are you sure you want to copy all user input data from " &
>> wbName
>> & " to this file?" ' Define message.
>> Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
>> Title = "Confirm Data Update" ' Define title.
>> Response = MsgBox(Msg, Style, Title, Help, Ctxt)
>> If Response = vbYes Then ' User chose Yes.
>> Dim bClosed As Boolean
>> On Error Resume Next
>> Set bk = Workbooks(wbName)
>> On Error GoTo 0
>> If bk Is Nothing Then
>> bClosed = True
>> Set bk = Workbooks.Open(wbName)
>> End If
>> 'Getting Data From Old Version
>> 'Handicap
>> bk2.Worksheets("Competitors A-Z").Range("D29") =
>> bk.Worksheets("Competitors A-Z").Range("D29")
>> 'Archery League Name
>> bk2.Worksheets("League's Score Board").Range("ArcheryLeagueName")
>> =
>> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
>> 'Max Make-Up Scores
>> bk2.Worksheets("Competitors A-Z").Range("MaxMakeupScores") =
>> bk.Worksheets("Competitors A-Z").Range("MaxMakeupScores")
>> 'Names
>> bk2.Worksheets("Competitors A-Z").Range("X4:X27").Value =
>> bk.Worksheets("Competitors A-Z").Range("X4:X27").Value
>> 'Scores, X-Counts, Make-Up, and Blind Data
>> bk2.Worksheets("Competitors A-Z").Range("AB4:BK27").Value =
>> bk.Worksheets("Competitors A-Z").Range("AB4:BK27").Value
>> If bClosed Then bk.Close Savechanges:=False
>> Else ' User chose No.
>> MsgBox "You Have Chosen Not To Update This File With Another Files
>> Data"
>> End If
>> End Sub
>>
>> Any help appreciated,
>> Dave Marden
>>
>>
>>

>
>



 
Reply With Quote
 
Dave Marden
Guest
Posts: n/a
 
      15th Jan 2007
Thanks JMB, I will try this out later tonight.

Dave Marden


"JMB" <(E-Mail Removed)> wrote in message
news:C2A1CBE4-1EC8-4FF7-AD1C-(E-Mail Removed)...
> Instead of
>> wbName2 = ActiveWorkbook.FullName
>> set bk2 = Workbooks(wbName2)

>
> I think you just need
> set bk2 = ActiveWorkbook
>
> However, it really is not necessary to set a variable for the workbook
> that
> is running the code. You can always reference the workbook containing the
> code that is running with ThisWorkbook. Also, if you need to refer to the
> same object many times, you can use a With statement
>
> With Thisworkbook
> .Worksheets("Competitors A-Z").Range("D29") =
> bk.Worksheets("Competitors A-Z").Range("D29")
> 'Archery League Name
> .Worksheets("League's Score Board").Range("ArcheryLeagueName") =
> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
>
> 'etc
>
> End With
>
>
>
> "Dave Marden" wrote:
>
>> I have decided to incorporate this change into all upcoming versions
>> of
>> my program. This has brought up a new problem. "Set bk =
>> Workbooks(wbName)" works fine for referencing the filename so I tried to
>> use
>> the same idea but for some reason it always gives me a "runtime error 9"
>> "Subscript out of range" error. I simply used bk2 for doing this. I
>> figured I didn't need the error checking since this file is obviously
>> going
>> to be already running. Any other way of referencing this or am I missing
>> something here?
>>
>> Public Sub cmdPullDataFromOldFile_Click()
>> Dim wbName As String, bk As Workbook
>> Dim bk2 As Workbook
>> wbName = Application.GetOpenFilename
>> wbName2 = ActiveWorkbook.FullName
>> set bk2 = Workbooks(wbName2)
>> Dim Msg, Style, Title, Help, Ctxt, Response, MyString
>> Msg = "Are you sure you want to copy all user input data from " &
>> wbName
>> & " to this file?" ' Define message.
>> Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
>> Title = "Confirm Data Update" ' Define title.
>> Response = MsgBox(Msg, Style, Title, Help, Ctxt)
>> If Response = vbYes Then ' User chose Yes.
>> Dim bClosed As Boolean
>> On Error Resume Next
>> Set bk = Workbooks(wbName)
>> On Error GoTo 0
>> If bk Is Nothing Then
>> bClosed = True
>> Set bk = Workbooks.Open(wbName)
>> End If
>> 'Getting Data From Old Version
>> 'Handicap
>> bk2.Worksheets("Competitors A-Z").Range("D29") =
>> bk.Worksheets("Competitors A-Z").Range("D29")
>> 'Archery League Name
>> bk2.Worksheets("League's Score Board").Range("ArcheryLeagueName")
>> =
>> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
>> 'Max Make-Up Scores
>> bk2.Worksheets("Competitors A-Z").Range("MaxMakeupScores") =
>> bk.Worksheets("Competitors A-Z").Range("MaxMakeupScores")
>> 'Names
>> bk2.Worksheets("Competitors A-Z").Range("X4:X27").Value =
>> bk.Worksheets("Competitors A-Z").Range("X4:X27").Value
>> 'Scores, X-Counts, Make-Up, and Blind Data
>> bk2.Worksheets("Competitors A-Z").Range("AB4:BK27").Value =
>> bk.Worksheets("Competitors A-Z").Range("AB4:BK27").Value
>> If bClosed Then bk.Close Savechanges:=False
>> Else ' User chose No.
>> MsgBox "You Have Chosen Not To Update This File With Another
>> Files
>> Data"
>> End If
>> End Sub
>>
>> Any help appreciated,
>> Dave Marden
>>
>>
>>
>>



 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      15th Jan 2007
but a lot of us that use newsgroups, especially those of us in ms betas, use
rules to distinguish posts from actual microsoft employees.

--


Gary


"Dave Marden" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I guess I didn't realize this would be a problem, they simply say ue an email
>address like (E-Mail Removed) so that is exactly what I used. I have
>posted on here several times in the past and your the first person I've ever
>had say that. I guess I would like to know waht others think about it. I
>assume that microsoft doesn't actually use that email address.
>
> Dave Marden
>
> "Gary Keramidas" <GKeramidasATmsn.com> wrote in message
> news:(E-Mail Removed)...
>> this is a personal preference, but, if you're not an employee of microsoft, i
>> really wish you didn't use @microsoft.com in your email address. use
>> (E-Mail Removed).
>>
>>
>> --
>>
>>
>> Gary
>>
>>
>> "Dave Marden" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> I have decided to incorporate this change into all upcoming versions of
>>> my program. This has brought up a new problem. "Set bk =
>>> Workbooks(wbName)" works fine for referencing the filename so I tried to use
>>> the same idea but for some reason it always gives me a "runtime error 9"
>>> "Subscript out of range" error. I simply used bk2 for doing this. I
>>> figured I didn't need the error checking since this file is obviously going
>>> to be already running. Any other way of referencing this or am I missing
>>> something here?
>>>
>>> Public Sub cmdPullDataFromOldFile_Click()
>>> Dim wbName As String, bk As Workbook
>>> Dim bk2 As Workbook
>>> wbName = Application.GetOpenFilename
>>> wbName2 = ActiveWorkbook.FullName
>>> set bk2 = Workbooks(wbName2)
>>> Dim Msg, Style, Title, Help, Ctxt, Response, MyString
>>> Msg = "Are you sure you want to copy all user input data from " & wbName
>>> & " to this file?" ' Define message.
>>> Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
>>> Title = "Confirm Data Update" ' Define title.
>>> Response = MsgBox(Msg, Style, Title, Help, Ctxt)
>>> If Response = vbYes Then ' User chose Yes.
>>> Dim bClosed As Boolean
>>> On Error Resume Next
>>> Set bk = Workbooks(wbName)
>>> On Error GoTo 0
>>> If bk Is Nothing Then
>>> bClosed = True
>>> Set bk = Workbooks.Open(wbName)
>>> End If
>>> 'Getting Data From Old Version
>>> 'Handicap
>>> bk2.Worksheets("Competitors A-Z").Range("D29") =
>>> bk.Worksheets("Competitors A-Z").Range("D29")
>>> 'Archery League Name
>>> bk2.Worksheets("League's Score Board").Range("ArcheryLeagueName") =
>>> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
>>> 'Max Make-Up Scores
>>> bk2.Worksheets("Competitors A-Z").Range("MaxMakeupScores") =
>>> bk.Worksheets("Competitors A-Z").Range("MaxMakeupScores")
>>> 'Names
>>> bk2.Worksheets("Competitors A-Z").Range("X4:X27").Value =
>>> bk.Worksheets("Competitors A-Z").Range("X4:X27").Value
>>> 'Scores, X-Counts, Make-Up, and Blind Data
>>> bk2.Worksheets("Competitors A-Z").Range("AB4:BK27").Value =
>>> bk.Worksheets("Competitors A-Z").Range("AB4:BK27").Value
>>> If bClosed Then bk.Close Savechanges:=False
>>> Else ' User chose No.
>>> MsgBox "You Have Chosen Not To Update This File With Another Files
>>> Data"
>>> End If
>>> End Sub
>>>
>>> Any help appreciated,
>>> Dave Marden
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Bob O`Bob
Guest
Posts: n/a
 
      15th Jan 2007
Dave Marden wrote:
> I guess I didn't realize this would be a problem, they simply say ue an
> email address like (E-Mail Removed) so that is exactly what I used. I
> have posted on here several times in the past and your the first person I've
> ever had say that. I guess I would like to know waht others think about it.
> I assume that microsoft doesn't actually use that email address.



You have no business assuming *anything* about *any* email address other
than those for which you've been granted authority.



Bob
--
 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      16th Jan 2007
I was under the impression that "invalid.com" was designated as signifying a
deliberately bogus name, useful for these purposes.
I now see that there is a URL "invalid.com", so it appears I was wrong all
these years.

NickHK

"Bob O`Bob" <(E-Mail Removed)> wrote in message
news:OQTml$(E-Mail Removed)...
> Dave Marden wrote:
> > I guess I didn't realize this would be a problem, they simply say ue an
> > email address like (E-Mail Removed) so that is exactly what I used.

I
> > have posted on here several times in the past and your the first person

I've
> > ever had say that. I guess I would like to know waht others think about

it.
> > I assume that microsoft doesn't actually use that email address.

>
>
> You have no business assuming *anything* about *any* email address other
> than those for which you've been granted authority.
>
>
>
> Bob
> --



 
Reply With Quote
 
Dave Marden
Guest
Posts: n/a
 
      16th Jan 2007
Thank you kindly sir, I greatly appreciate it.

Dave Marden

"Dave Marden" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks JMB, I will try this out later tonight.
>
> Dave Marden
>
>
> "JMB" <(E-Mail Removed)> wrote in message
> news:C2A1CBE4-1EC8-4FF7-AD1C-(E-Mail Removed)...
>> Instead of
>>> wbName2 = ActiveWorkbook.FullName
>>> set bk2 = Workbooks(wbName2)

>>
>> I think you just need
>> set bk2 = ActiveWorkbook
>>
>> However, it really is not necessary to set a variable for the workbook
>> that
>> is running the code. You can always reference the workbook containing
>> the
>> code that is running with ThisWorkbook. Also, if you need to refer to
>> the
>> same object many times, you can use a With statement
>>
>> With Thisworkbook
>> .Worksheets("Competitors A-Z").Range("D29") =
>> bk.Worksheets("Competitors A-Z").Range("D29")
>> 'Archery League Name
>> .Worksheets("League's Score Board").Range("ArcheryLeagueName") =
>> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
>>
>> 'etc
>>
>> End With
>>
>>
>>
>> "Dave Marden" wrote:
>>
>>> I have decided to incorporate this change into all upcoming versions
>>> of
>>> my program. This has brought up a new problem. "Set bk =
>>> Workbooks(wbName)" works fine for referencing the filename so I tried to
>>> use
>>> the same idea but for some reason it always gives me a "runtime error 9"
>>> "Subscript out of range" error. I simply used bk2 for doing this. I
>>> figured I didn't need the error checking since this file is obviously
>>> going
>>> to be already running. Any other way of referencing this or am I
>>> missing
>>> something here?
>>>
>>> Public Sub cmdPullDataFromOldFile_Click()
>>> Dim wbName As String, bk As Workbook
>>> Dim bk2 As Workbook
>>> wbName = Application.GetOpenFilename
>>> wbName2 = ActiveWorkbook.FullName
>>> set bk2 = Workbooks(wbName2)
>>> Dim Msg, Style, Title, Help, Ctxt, Response, MyString
>>> Msg = "Are you sure you want to copy all user input data from " &
>>> wbName
>>> & " to this file?" ' Define message.
>>> Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
>>> Title = "Confirm Data Update" ' Define title.
>>> Response = MsgBox(Msg, Style, Title, Help, Ctxt)
>>> If Response = vbYes Then ' User chose Yes.
>>> Dim bClosed As Boolean
>>> On Error Resume Next
>>> Set bk = Workbooks(wbName)
>>> On Error GoTo 0
>>> If bk Is Nothing Then
>>> bClosed = True
>>> Set bk = Workbooks.Open(wbName)
>>> End If
>>> 'Getting Data From Old Version
>>> 'Handicap
>>> bk2.Worksheets("Competitors A-Z").Range("D29") =
>>> bk.Worksheets("Competitors A-Z").Range("D29")
>>> 'Archery League Name
>>> bk2.Worksheets("League's Score
>>> Board").Range("ArcheryLeagueName") =
>>> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
>>> 'Max Make-Up Scores
>>> bk2.Worksheets("Competitors A-Z").Range("MaxMakeupScores") =
>>> bk.Worksheets("Competitors A-Z").Range("MaxMakeupScores")
>>> 'Names
>>> bk2.Worksheets("Competitors A-Z").Range("X4:X27").Value =
>>> bk.Worksheets("Competitors A-Z").Range("X4:X27").Value
>>> 'Scores, X-Counts, Make-Up, and Blind Data
>>> bk2.Worksheets("Competitors A-Z").Range("AB4:BK27").Value =
>>> bk.Worksheets("Competitors A-Z").Range("AB4:BK27").Value
>>> If bClosed Then bk.Close Savechanges:=False
>>> Else ' User chose No.
>>> MsgBox "You Have Chosen Not To Update This File With Another
>>> Files
>>> Data"
>>> End If
>>> End Sub
>>>
>>> Any help appreciated,
>>> Dave Marden
>>>
>>>
>>>
>>>

>
>



 
Reply With Quote
 
=?Utf-8?B?Sk1C?=
Guest
Posts: n/a
 
      17th Jan 2007
You are most welcome.

"Dave Marden" wrote:

> Thank you kindly sir, I greatly appreciate it.
>
> Dave Marden
>
> "Dave Marden" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Thanks JMB, I will try this out later tonight.
> >
> > Dave Marden
> >
> >
> > "JMB" <(E-Mail Removed)> wrote in message
> > news:C2A1CBE4-1EC8-4FF7-AD1C-(E-Mail Removed)...
> >> Instead of
> >>> wbName2 = ActiveWorkbook.FullName
> >>> set bk2 = Workbooks(wbName2)
> >>
> >> I think you just need
> >> set bk2 = ActiveWorkbook
> >>
> >> However, it really is not necessary to set a variable for the workbook
> >> that
> >> is running the code. You can always reference the workbook containing
> >> the
> >> code that is running with ThisWorkbook. Also, if you need to refer to
> >> the
> >> same object many times, you can use a With statement
> >>
> >> With Thisworkbook
> >> .Worksheets("Competitors A-Z").Range("D29") =
> >> bk.Worksheets("Competitors A-Z").Range("D29")
> >> 'Archery League Name
> >> .Worksheets("League's Score Board").Range("ArcheryLeagueName") =
> >> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
> >>
> >> 'etc
> >>
> >> End With
> >>
> >>
> >>
> >> "Dave Marden" wrote:
> >>
> >>> I have decided to incorporate this change into all upcoming versions
> >>> of
> >>> my program. This has brought up a new problem. "Set bk =
> >>> Workbooks(wbName)" works fine for referencing the filename so I tried to
> >>> use
> >>> the same idea but for some reason it always gives me a "runtime error 9"
> >>> "Subscript out of range" error. I simply used bk2 for doing this. I
> >>> figured I didn't need the error checking since this file is obviously
> >>> going
> >>> to be already running. Any other way of referencing this or am I
> >>> missing
> >>> something here?
> >>>
> >>> Public Sub cmdPullDataFromOldFile_Click()
> >>> Dim wbName As String, bk As Workbook
> >>> Dim bk2 As Workbook
> >>> wbName = Application.GetOpenFilename
> >>> wbName2 = ActiveWorkbook.FullName
> >>> set bk2 = Workbooks(wbName2)
> >>> Dim Msg, Style, Title, Help, Ctxt, Response, MyString
> >>> Msg = "Are you sure you want to copy all user input data from " &
> >>> wbName
> >>> & " to this file?" ' Define message.
> >>> Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
> >>> Title = "Confirm Data Update" ' Define title.
> >>> Response = MsgBox(Msg, Style, Title, Help, Ctxt)
> >>> If Response = vbYes Then ' User chose Yes.
> >>> Dim bClosed As Boolean
> >>> On Error Resume Next
> >>> Set bk = Workbooks(wbName)
> >>> On Error GoTo 0
> >>> If bk Is Nothing Then
> >>> bClosed = True
> >>> Set bk = Workbooks.Open(wbName)
> >>> End If
> >>> 'Getting Data From Old Version
> >>> 'Handicap
> >>> bk2.Worksheets("Competitors A-Z").Range("D29") =
> >>> bk.Worksheets("Competitors A-Z").Range("D29")
> >>> 'Archery League Name
> >>> bk2.Worksheets("League's Score
> >>> Board").Range("ArcheryLeagueName") =
> >>> bk.Worksheets("League's Score Board").Range("ArcheryLeagueName")
> >>> 'Max Make-Up Scores
> >>> bk2.Worksheets("Competitors A-Z").Range("MaxMakeupScores") =
> >>> bk.Worksheets("Competitors A-Z").Range("MaxMakeupScores")
> >>> 'Names
> >>> bk2.Worksheets("Competitors A-Z").Range("X4:X27").Value =
> >>> bk.Worksheets("Competitors A-Z").Range("X4:X27").Value
> >>> 'Scores, X-Counts, Make-Up, and Blind Data
> >>> bk2.Worksheets("Competitors A-Z").Range("AB4:BK27").Value =
> >>> bk.Worksheets("Competitors A-Z").Range("AB4:BK27").Value
> >>> If bClosed Then bk.Close Savechanges:=False
> >>> Else ' User chose No.
> >>> MsgBox "You Have Chosen Not To Update This File With Another
> >>> Files
> >>> Data"
> >>> End If
> >>> End Sub
> >>>
> >>> Any help appreciated,
> >>> Dave Marden
> >>>
> >>>
> >>>
> >>>

> >
> >

>
>
>

 
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
Correct syntax for referencing a form control???? Weeble Microsoft Access Forms 2 1st Dec 2009 03:19 PM
Referencing a Figure Charles W Davis Microsoft Word New Users 5 23rd Aug 2009 11:32 AM
Re: Syntax error I can't figure out David F Cox Microsoft Access Getting Started 0 1st Dec 2006 12:23 AM
Can't Figure Out Correct Syntax Wayne Wengert Microsoft VB .NET 2 15th Feb 2006 06:34 PM
Can't figure out the syntax =?Utf-8?B?Ympub3Zh?= Microsoft Access Queries 1 22nd Oct 2004 05:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:28 AM.