Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Activating a workbook

I am using a PDF converter to get some data out of the pdf into an excel
spreadsheet. The converter opens a new workbook (normally Book1.xls). I
also have a workbook that contains my code to take the data out of the newly
opened workbook into my current workbook. when i run the code i get a
run-time error 9 when trying to activate the newly open workbook. This does
not happen if i save the workbook and close it then reopen it.

can anyone help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Activating a workbook

You current code would help.
But I would guess it has something to do using ActiveWorkbbok/Sheet.

NickHK

"Boldie" wrote in message
...
I am using a PDF converter to get some data out of the pdf into an excel
spreadsheet. The converter opens a new workbook (normally Book1.xls). I
also have a workbook that contains my code to take the data out of the

newly
opened workbook into my current workbook. when i run the code i get a
run-time error 9 when trying to activate the newly open workbook. This

does
not happen if i save the workbook and close it then reopen it.

can anyone help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Activating a workbook

This is my code

Dim BookName As String
Dim RowNum As Integer
'
BookName = ActiveWorkbook.Name
Windows("Book1.xls").Activate **** This is where i get the error.
Range("A1").Activate
Do
If Not IsNumeric(ActiveCell.Text) Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until ActiveCell.Value = "End"

ActiveCell.Value = ""
RowNum = ActiveCell.Row

Range("A1:A" & RowNum).Select
Selection.Copy
Windows(BookName).Activate

Range("C1").Activate
Do
ActiveCell.Offset(1, 0).Activate
Loop Until ActiveCell.Value = ""

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True

Range("A1").Activate
End Sub


"NickHK" wrote:

You current code would help.
But I would guess it has something to do using ActiveWorkbbok/Sheet.

NickHK

"Boldie" wrote in message
...
I am using a PDF converter to get some data out of the pdf into an excel
spreadsheet. The converter opens a new workbook (normally Book1.xls). I
also have a workbook that contains my code to take the data out of the

newly
opened workbook into my current workbook. when i run the code i get a
run-time error 9 when trying to activate the newly open workbook. This

does
not happen if i save the workbook and close it then reopen it.

can anyone help.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Activating a workbook

What if you change it to Workbooks("Book1.xls").Activate ?
But it is seldom necessary to Activate/Select objects before you work with
them.
Dim i As Long

With Workbooks("Book1.xls")
Do
'Note the "." before Range now
If Not IsNumeric(.Range("A1").Offset(i,0).Text) Then
...etc
End If
i=i+1

NickHK

"Boldie" wrote in message
...
This is my code

Dim BookName As String
Dim RowNum As Integer
'
BookName = ActiveWorkbook.Name
Windows("Book1.xls").Activate **** This is where i get the

error.
Range("A1").Activate
Do
If Not IsNumeric(ActiveCell.Text) Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until ActiveCell.Value = "End"

ActiveCell.Value = ""
RowNum = ActiveCell.Row

Range("A1:A" & RowNum).Select
Selection.Copy
Windows(BookName).Activate

Range("C1").Activate
Do
ActiveCell.Offset(1, 0).Activate
Loop Until ActiveCell.Value = ""

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,

SkipBlanks _
:=False, Transpose:=True

Range("A1").Activate
End Sub


"NickHK" wrote:

You current code would help.
But I would guess it has something to do using ActiveWorkbbok/Sheet.

NickHK

"Boldie" wrote in message
...
I am using a PDF converter to get some data out of the pdf into an

excel
spreadsheet. The converter opens a new workbook (normally Book1.xls).

I
also have a workbook that contains my code to take the data out of the

newly
opened workbook into my current workbook. when i run the code i get a
run-time error 9 when trying to activate the newly open workbook.

This
does
not happen if i save the workbook and close it then reopen it.

can anyone help.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Activating a workbook

I have tried that but it still doesn't work. Have you any more ideas?

"NickHK" wrote:

What if you change it to Workbooks("Book1.xls").Activate ?
But it is seldom necessary to Activate/Select objects before you work with
them.
Dim i As Long

With Workbooks("Book1.xls")
Do
'Note the "." before Range now
If Not IsNumeric(.Range("A1").Offset(i,0).Text) Then
...etc
End If
i=i+1

NickHK

"Boldie" wrote in message
...
This is my code

Dim BookName As String
Dim RowNum As Integer
'
BookName = ActiveWorkbook.Name
Windows("Book1.xls").Activate **** This is where i get the

error.
Range("A1").Activate
Do
If Not IsNumeric(ActiveCell.Text) Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until ActiveCell.Value = "End"

ActiveCell.Value = ""
RowNum = ActiveCell.Row

Range("A1:A" & RowNum).Select
Selection.Copy
Windows(BookName).Activate

Range("C1").Activate
Do
ActiveCell.Offset(1, 0).Activate
Loop Until ActiveCell.Value = ""

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,

SkipBlanks _
:=False, Transpose:=True

Range("A1").Activate
End Sub


"NickHK" wrote:

You current code would help.
But I would guess it has something to do using ActiveWorkbbok/Sheet.

NickHK

"Boldie" wrote in message
...
I am using a PDF converter to get some data out of the pdf into an

excel
spreadsheet. The converter opens a new workbook (normally Book1.xls).

I
also have a workbook that contains my code to take the data out of the
newly
opened workbook into my current workbook. when i run the code i get a
run-time error 9 when trying to activate the newly open workbook.

This
does
not happen if i save the workbook and close it then reopen it.

can anyone help.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Activating a workbook

If it fails in Workbooks("Book1.xls").Activate, you do not have a
"Book1.xls".
Check the name.
Or is it not visible ?

Which error do get ?


"Boldie" wrote in message
...
I have tried that but it still doesn't work. Have you any more ideas?

"NickHK" wrote:

What if you change it to Workbooks("Book1.xls").Activate ?
But it is seldom necessary to Activate/Select objects before you work

with
them.
Dim i As Long

With Workbooks("Book1.xls")
Do
'Note the "." before Range now
If Not IsNumeric(.Range("A1").Offset(i,0).Text) Then
...etc
End If
i=i+1

NickHK

"Boldie" wrote in message
...
This is my code

Dim BookName As String
Dim RowNum As Integer
'
BookName = ActiveWorkbook.Name
Windows("Book1.xls").Activate **** This is where i get the

error.
Range("A1").Activate
Do
If Not IsNumeric(ActiveCell.Text) Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until ActiveCell.Value = "End"

ActiveCell.Value = ""
RowNum = ActiveCell.Row

Range("A1:A" & RowNum).Select
Selection.Copy
Windows(BookName).Activate

Range("C1").Activate
Do
ActiveCell.Offset(1, 0).Activate
Loop Until ActiveCell.Value = ""

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,

SkipBlanks _
:=False, Transpose:=True

Range("A1").Activate
End Sub


"NickHK" wrote:

You current code would help.
But I would guess it has something to do using ActiveWorkbbok/Sheet.

NickHK

"Boldie" wrote in message
...
I am using a PDF converter to get some data out of the pdf into an

excel
spreadsheet. The converter opens a new workbook (normally

Book1.xls).
I
also have a workbook that contains my code to take the data out of

the
newly
opened workbook into my current workbook. when i run the code i

get a
run-time error 9 when trying to activate the newly open workbook.

This
does
not happen if i save the workbook and close it then reopen it.

can anyone help.








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
Working within a workbook without activating it? hyyfte[_11_] Excel Programming 3 June 4th 06 08:00 PM
activating a workbook VB Script for Excel Excel Programming 12 March 22nd 06 07:55 AM
Working within a workbook without activating it? hyyfte[_9_] Excel Programming 1 September 20th 04 03:34 PM
Open workbook without activating it Kelley[_2_] Excel Programming 3 October 29th 03 04:49 PM
Activating a workbook help bmwmcrider Excel Programming 1 October 21st 03 01:48 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"