Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Working within a workbook without activating it? | Excel Programming | |||
activating a workbook | Excel Programming | |||
Working within a workbook without activating it? | Excel Programming | |||
Open workbook without activating it | Excel Programming | |||
Activating a workbook help | Excel Programming |