Can I generate more than 1 Excel sheet when a command button is clicked?
For eg
I search for 2 names of audit dept and click print command button where records will be printed in Excel.
Again if I search for other 2 names and if I click print command button reports will not be printed.and gives error I have to close the program and load the program again.
If yes can you tell me how?
When I write a code when it executes or second Excel sheet it gives error
10 1948
can i generate more than 1 excel sheets when a command button is clicked
for eg
i search for 2 names of audit dept and click print command button where records will be printed in excel
again if i search for other 2 names and if i click print command button reports will not be printed.and gives error i have to close the program and load the program again
if yes can u tell me how.
hen i wrte a cde whenit eecutes or second exce sheet it gives error
--------------------------------------------------------------------------------
Can you explain detail?
VB Version?
you mean Report or excel sheet, then there versions?
Can you explain detail?
VB Version?
you mean Report or excel sheet, then there versions?
I am using VB6. I have coded in VB6 to generate an Excel sheet and put the data from Access to Excel sheet.
First time data will be placed in Excel sheet appropriately.
But again when I want to create it gives error Object variable or with block variable not set
please help.Very urgent.
Thanks
I think we'll need to see the code. It sounds as though you have created an Excel object in your program at startup or something, then released it (Set ... = Nothing) after using it, so then you can't use it again.
QVeen72 1,445
Recognized Expert Top Contributor
Hi,
U will have to Release all the objects related to Excel, Otherwise u will get that error, Close and Set to Nothing xlApp object and xlwrkbook/xlsheet objects..
REgards
Veena
I am using VB6. I have coded in VB6 to generate an Excel sheet and put the data from Access to Excel sheet.
First time data will be placed in Excel sheet appropriately.
But again when I want to create it gives error Object variable or with block variable not set
please help.Very urgent.
Thanks
- Dim objexcel As excel.Application
-
Set objexcel = New excel.Application
-
objexcel.Visible = True
-
objexcel.SheetsInNewWorkbook = 4
-
objexcel.Workbooks.Add
-
-
-
Dim rsa As New ADODB.Recordset
-
rsa.Open "select count(*) from temp", conn, adOpenDynamic, adLockOptimistic
-
With rsa
-
Dim s As Integer
-
s = rsa.Fields(0)
-
Dim a As Integer
-
End With
-
rsa.Close
-
-
Dim rs As New ADODB.Recordset
-
rs.CursorLocation = adUseClient
-
rs.Open "select * from temp", conn, adOpenDynamic, adLockOptimistic
-
-
Dim strSQL As String
-
Dim n As Integer
-
Dim intcount2 As Integer
-
intcount2 = 0
-
intcount = 0
-
With rs
-
While rs.EOF = False
-
If rs.Fields(0) < 7 Then
-
ActiveSheet.Cells(intcount + 2, 1) = !Name
-
ActiveSheet.Cells(intcount + 3, 1) = !Des
-
ActiveSheet.Cells(intcount + 4, 1) = !comp
pls help this is th code
QVeen72 1,445
Recognized Expert Top Contributor
hI,
write this code at the end:
Set objexcel = Nothing
REgards
Veena
hI,
write this code at the end:
Set objexcel = Nothing
REgards
Veena
write objexcel=noting
but it dos not work
QVeen72 1,445
Recognized Expert Top Contributor
Hi,
If u already ebcountered that problem, u need to restart ur system and at the end it is "Set ObjExcel = Nothing"
REgards
Veena
Hi,
If u already ebcountered that problem, u need to restart ur system and at the end it is "Set ObjExcel = Nothing"
REgards
Veena
still it is not working
...ActiveSheet.Cells(intcount + 2, 1) = !Name ...
Are you sure this is VB6? I wouldn't have thought VB would understand ActiveSheet. Isn't that a VBA thing?
I don't have time to check this at the moment, sorry.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Allison Bailey |
last post by:
Hi Folks,
I'm a brand new Python programmer, so please point me in the right
direction if this is not the best forum for this question....
I would like to open an existing MS Excel spreadsheet...
|
by: Iris |
last post by:
I have 8 text files (tab delimited) that I would like to import into an Excel workbook as 8 individual worksheets but I cannot find any example code on this subject. Can anyone help me please????
...
|
by: paul.chae |
last post by:
I have a table in Access with about 3000 records. There are ~60 unique
values in the ID field for the 3000 records. What I would like to do
is automatically generate multiple Excel worksheets...
|
by: dan_roman |
last post by:
Hi,
I developed a script with a nice interface in Tkinter that allows me to
edit some formulas and to generate an Excel worksheet with VBA macros
within it. The script runs perfectlly in Office...
|
by: Abdhul Saleem |
last post by:
Hi,
I am recieving error ActiveX component can't create object in the following
line in the asp page.
set ExcelApp = CreateObject("Excel.Application")
Previously this code was working fine....
| |
by: LadyRed2 |
last post by:
Hello,
I am new to Excel and SQL server, so please be patient with me. I have written code with the help of others to update a table in a sql database from an excel form.
The connection code...
|
by: dprjessie |
last post by:
Hello,
I am a Web programmer and I'm working on my first desktop application as a favor for a friend. I'm sure I have a stupid error here, but there is no error being thrown so I can't figure out...
|
by: sejal17 |
last post by:
hello
Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
|
by: stjones1 |
last post by:
My company has implementd Vista with IE7 and office 2007. We also use Sharepoint extensively for team sites and division portals. I am in Sharepoint consultation/support.
One user just moved a...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |