Difficulty In Counting Total Pages Printed.
hi,
I encounter difficulties in getting total pages printed in my printer.. i searched everything here but i didnt found any code that i want..
I want to know how many times did my printer print since its first used???
i have only 1 label in the form. When i run this form it automatically show on label the current pages printed..
thanks,
dcarreon
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Total Number Of Pages Printed Using API/winspool.drv
I want to create some kind of report (or table) with the total number of printed pages from our printers. I've been able to find the code to show the number of current printjobs in a printqueue, but is it possible to modify it so I can get a total number of printed pages? Here's the most important part of code for the number of prints in the printqueue:
-------------
Code:
Option Explicit
Public Type JOB_INFO_1_API
JobId As Long
pPrinterName As Long
pMachineName As Long
pUserName As Long
pDocument As Long
pDatatype As Long
pStatus As Long
Status As Long
Priority As Long
Position As Long
TotalPages As Long
PagesPrinted As Long
Submitted As SYSTEMTIME
End Type
Public Type JOB_INFO_1
JobId As Long
pPrinterName As String
pMachineName As String
pUserName As String
pDocument As String
pDatatype As String
pStatus As String
Status As Long
Priority As Long
Position As Long
TotalPages As Long
PagesPrinted As Long
Submitted As SYSTEMTIME
End Type
'API Declarations
Public Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, _
pDefault As PRINTER_DEFAULTS) As Long
Public Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal HPrinter As Long, ByVal FirstJob As Long, _
ByVal NoJobs As Long, ByVal Level As Long, ByVal pJob As Long, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Public Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
'Get the number of Jobs in the specified Printer Queue (max 128)... the PrinterName can be a network path: "\MYSERVERMYPRINTER"
Function GetPrinterQueue(PrinterName As String) As Long
Dim PrinterStruct As PRINTER_DEFAULTS
Dim HPrinter As Long
Dim ret As Boolean
Dim Jobs(0 To 127) As JOB_INFO_1_API
Dim pcbNeeded As Long
Dim pcReturned As Long
Dim i As Integer
Dim TempBuff As Long
'Initialize the Printer structure
PrinterStruct.pDatatype = vbNullString
PrinterStruct.pDevMode.dmSize = Len(PrinterStruct.pDevMode)
PrinterStruct.DesiredAccess = PRINTER_ACCESS_USE
'Get the printer Handle
ret = OpenPrinter(PrinterName, HPrinter, PrinterStruct)
'Get the Printer active jobs
ret = EnumJobs(HPrinter, 0, 127, 1, TempBuff, 0, pcbNeeded, pcReturned)
If pcbNeeded = 0 Then
GetPrinterQueue = 0
Else
'Allocate the Buffer
TempBuff = HeapAlloc(GetProcessHeap(), 0, pcbNeeded)
ret = EnumJobs(HPrinter, 0, 127, 1, TempBuff, pcbNeeded, pcbNeeded, pcReturned)
CopyMem Jobs(0), ByVal TempBuff, pcbNeeded
For i = 0 To pcReturned - 1
JobsDesc(i).pPrinterName = LPSTRtoSTRING(Jobs(i).pPrinterName)
JobsDesc(i).pMachineName = LPSTRtoSTRING(Jobs(i).pMachineName)
JobsDesc(i).pUserName = LPSTRtoSTRING(Jobs(i).pUserName)
JobsDesc(i).pDocument = LPSTRtoSTRING(Jobs(i).pDocument)
JobsDesc(i).pDatatype = LPSTRtoSTRING(Jobs(i).pDatatype)
JobsDesc(i).pStatus = LPSTRtoSTRING(Jobs(i).pStatus)
JobsDesc(i).JobId = Jobs(i).JobId
JobsDesc(i).Status = Jobs(i).Status
JobsDesc(i).Priority = Jobs(i).Priority
JobsDesc(i).Position = Jobs(i).Position
JobsDesc(i).TotalPages = Jobs(i).TotalPages
JobsDesc(i).PagesPrinted = Jobs(i).PagesPrinted
JobsDesc(i).Submitted = Jobs(i).Submitted
Next
If TempBuff Then HeapFree GetProcessHeap(), 0, TempBuff
GetPrinterQueue = pcReturned
End If
'Close printer
ret = CloseHandle(HPrinter)
End Function
Private Sub cmdInQueue_Click()
'Get the Printer's Queue
MsgBox "Number of jobs in queue: " & GetPrinterQueue("\servername" & _
InputBox("Give printername:", "Printername"))
End Sub
---------------------------
Thanks in advance,
Menno Kuiper
the Netherlands
How Many Pages Printed?
Hi,
Is there anyone who could throw some light on this rather peculiar request of mine?
Consider this-
My application prints out reports running into more than 70-100 pages at times.
Sometimes the paper gets stuck in the printer or there is a power failure or the PC or printer hangs for some reason and the whole process needs to be restarted.
Is it possible to know upto which page the printer has printed the report?
My understanding is, once the application passes control to the printer spooler then there is no communication with the spooler. Does the printer in any way return the number of pages being printed as they are being printed? Can it be trapped in any way?
Any help would be much appreciated.
Dandyboy
Total Of Printed Page Number
i need help on how to find number of total page printed...for example i've printed microsoft word document and want to obtain the number of total pages printed..i try printer.page but the output is 1...
i'm using shellexecute method and print from the commondialog option
Help With Keeping A Running Total That Will Be Printed In A Pic Box On Another Form
I am currently stuck on this program that is due in only a few hours for my programming class. I need to figure out how to keep a running total from inputs on 3 textboxes in my program and display them on a separate form as a summary. This has been bugging me for hours and if anyone has any examples to email me or anything, I just need to see an example of how to do this and I believe I can relate the information into what I need.
Thank You,
Shane
Number Of Pages Printed
hello everyone. does anyone know how to get the number of pages the printer has printed? is it even possible?
I need to keep track of how the printer is used to avoid misuse.
any help would be greatly appreciated. thanks.
Count Printed Pages
We have to control toner / paper cost of a printer which we have attached to
a network pc.
We want a log of printed documents.
the log should contain :
Name of the document printed
No. of Pages printed
owner of the document
date/time when the document was printed
this will help us compile data & highlight misuse (if any)
Is there any utility which can do this job. Or can any body suggest any
program code which can do the same job
any help in this subject would be highly appreciated.
With best regards
makarand
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.717 / Virus Database: 473 - Release Date: 08/07/2004
Count The Number Of PAges To Be Printed
Hello,
I would like to know if there is a way to count the number of pages to be printed in VB6 before I perform a
printer.enddoc
I have to cancel all jobs that have more than 2 pages.
Thanks
Mark
Pass Number Of Pages To Be Printed
Hi:
I've created a datareport that gets displayed so that the user can see the report before it is actually printed.
What I would like to do now is once the user clicks on the print button, to have 3 copies printed automatically with out the user having to enter the number of copies in the print dialog.
Can someone tell me how to accomplish this?
Thanks in advance
Donald
Printed Pages On Shared Printers
I would like to write a program that will automatically count the number of
pages sent to a specific shared printer on a network. The network is coposed
of 10 computers on a pair to pair network under Win98. 4 of them have shared
printers attached to their LPT ports.
Any one coan help me by telling how to do this, or send any vb code
available for me?
thanks
JA
Control The Number Of Pages Printed
I would appreciate any help regarding this topic:
I need that my application count the number of pages that were sent to print (from any other application), to carry out a printing control.
Thank you!!
Find The Toal Pages Printed In A Print Job...please Help Me
Dear Guru,Leaders and members of vbcity,
I am writing a project to trap the total number of pages printed in each print job. The following code I took from one of the vbcity.com postings. But I am not able to display the number of pages printed while the document name and the username are being displayed without any problem. why? can any one help me solve this problem.
thank you all in advance.
Peter Wesly
Private Sub CheckPrinter()
Dim hPrinter As Long
Dim ByteBuf As Long, BytesNeeded As Long
Dim PI2 As PRINTER_INFO_2
Dim JI2 As JOB_INFO_2
Dim PrinterInfo() As Byte
Dim JobInfo() As Byte
Dim result As Long, LastError As Long
Dim PrinterName As String, tempStr As String
Dim NumJI2 As Long
Dim pDefaults As PRINTER_DEFAULTS
'Clear the lists for new info/status
List1.Clear
List2.Clear
'NOTE: You can pick a printer from the Printers Collection
'or use the EnumPrinters() API to select a printer name.
'Use the default printer of Printers collection
PrinterName = Printer.DeviceName
'Set desired access security setting
pDefaults.DesiredAccess = PRINTER_ACCESS_USE
'Call API to get a handle to the printer
result = OpenPrinter(PrinterName, hPrinter, pDefaults)
If result = 0 Then
'If an error occured, display an error and exit sub
MsgBox "Cannot open printer " & PrinterName & ", Error: " & Err.LastDllError
Exit Sub
End If
'Init BytesNeeded
BytesNeeded = 0
'Clear the error object of any errors
Err.Clear
'Determine the buffer size needed to get printer info
result = GetPrinter(hPrinter, 2, 0&, 0&, BytesNeeded)
'Check for error calling GetPrinter
If Err.LastDllError <> ERROR_INSUFFICIENT_BUFFER Then
'Display an error message, close printer, and exit sub
List1.AddItem " > GetPrinter Failed on initial call! <"
ClosePrinter hPrinter
Exit Sub
End If
'Due to a problem with GetPrinter, we must allocate a buffer as
'much as 3 times larger than the value returned by the initial
'call to GetPrinter. See page 790 of Charles Petzold's book
'"Programming Windows 95" for additional information
ReDim PrinterInfo(1 To BytesNeeded * 3)
ByteBuf = BytesNeeded
'Call GetPrinter to get the status
result = GetPrinter(hPrinter, 2, PrinterInfo(1), ByteBuf, BytesNeeded * 3)
'Check for errors
If result = 0 Then
'Determine the error that occured
LastError = Err.LastDllError()
'Display error message, close printer, and exit sub
List1.AddItem "Couldn't get Printer Status!"
List1.AddItem "... Error = " & LastError
ClosePrinter hPrinter
Exit Sub
End If
'Copy contents of printer status byte array into a
'PRINTER INFO 2 structure to separate the individual elements
CopyMemory PI2, PrinterInfo(1), Len(PI2)
'Check if printer is in ready state
If PI2.Status = 0 Then
List1.AddItem "Printer Status = Ready"
Else
List1.AddItem "Printer Status = " & PI2.Status
End If
'Add printer name, driver, and port to list
List1.AddItem "Printer Name = " & GetString(PI2.pPrinterName)
List1.AddItem "Printer Driver Name = " & GetString(PI2.pDriverName)
List1.AddItem "Printer Port Name = " & GetString(PI2.pPortName)
'Call API to get size of buffer needed
result = EnumJobs(hPrinter, 0&, 1, 2, 0&, 0&, BytesNeeded, NumJI2)
'Check if there are no current jobs and display appropriate message
If BytesNeeded = 0 Then
List2.AddItem "No Print Jobs!"
Else
'Redim byte array to hold info about print job
ReDim JobInfo(1 To BytesNeeded * 3)
'Call API to get print job info
result = EnumJobs(hPrinter, 0&, 1, 2, JobInfo(1), BytesNeeded * 3, ByteBuf, NumJI2)
'Check for errors
If result = 0 Then
'Get and display error, close printer, and exit sub
LastError = Err.LastDllError
List2.AddItem " > EnumJobs Failed on second call! <"
List2.AddItem "... Error = " & LastError
ClosePrinter hPrinter
Exit Sub
End If
'Copy contents of print job info byte array into a
'JOB INFO 2 structure to separate the individual elements
CopyMemory JI2, JobInfo(1), Len(JI2)
Debug.Print "Job ID" & vbTab & JI2.JobId
Debug.Print "Name Of Printer" & vbTab & GetString(JI2.pPrinterName)
Debug.Print "Name Of Machine That Created Job" & vbTab & GetString(JI2.pMachineName)
Debug.Print "Print Job Owner's Name" & vbTab & GetString(JI2.pUserName)
Debug.Print "Name Of Document" & vbTab & GetString(JI2.pDocument)
Debug.Print "Name Of User To Notify" & vbTab & GetString(JI2.pNotifyName)
Debug.Print "Type Of Data" & vbTab & GetString(JI2.pDatatype)
Debug.Print "Print Processor" & vbTab & GetString(JI2.pPrintProcessor)
Debug.Print "Print Processor Parameters" & vbTab & GetString(JI2.pParameters)
Debug.Print "Print Driver Name" & vbTab & GetString(JI2.pDriverName)
Debug.Print "Print Job 'P' Status" & vbTab & GetString(JI2.pStatus)
Debug.Print "Print Job Status" & vbTab & JI2.Status
Debug.Print "Print Job Priority" & vbTab & JI2.Priority
Debug.Print "Position in Queue" & vbTab & JI2.Position
Debug.Print "Earliest Time Job Can Be Printed" & vbTab & JI2.StartTime
Debug.Print "Latest Time Job Will Be Printed" & vbTab & JI2.UntilTime
Debug.Print "Total Pages For Entire Job" & vbTab & JI2.TotalPages
Debug.Print "Size of Job In Bytes" & vbTab & JI2.Size
'Due to a bug since NT 3.51, the time member is not set correctly
'so don't use it.
Debug.Print "Elapsed Print Time" & vbTab & JI2.time
Debug.Print "Pages Printed So Far" & vbTab & JI2.PagesPrinted
'Display basic job status info
List2.AddItem "Job ID = " & JI2.JobId
List2.AddItem "Total Pages = " & JI2.TotalPages
List2.AddItem "Job Time = " & JI2.time
List2.AddItem "Printed Pages = " & JI2.PagesPrinted
List2.AddItem "Machine = " & GetString(JI2.pMachineName)
List2.AddItem "User = " & GetString(JI2.pUserName)
List2.AddItem "Document = " & GetString(JI2.pDocument)
List2.AddItem "Job status = " & JI2.pStatus
'Check for a ready state
If JI2.Status = 0 Then
tempStr = tempStr & "Ready! "
Else 'Check for the various print job states
If (JI2.Status And JOB_STATUS_SPOOLING) > 0 Then
tempStr = tempStr & "Spooling "
End If
If (JI2.Status And JOB_STATUS_OFFLINE) > 0 Then
tempStr = tempStr & "Off line "
End If
If (JI2.Status And JOB_STATUS_PAUSED) > 0 Then
tempStr = tempStr & "Paused "
End If
If (JI2.Status And JOB_STATUS_ERROR) > 0 Then
tempStr = tempStr & "Error "
End If
If (JI2.Status And JOB_STATUS_PAPEROUT) > 0 Then
tempStr = tempStr & "Paper Out "
End If
If (JI2.Status And JOB_STATUS_PRINTING) > 0 Then
tempStr = tempStr & "Printing "
End If
If (JI2.Status And JOB_STATUS_USER_INTERVENTION) > 0 Then
tempStr = tempStr & "User Intervention Needed "
End If
If Len(tempStr) = 0 Then
tempStr = "Unknown Status of " & JI2.Status
End If
End If
'Display the status
List2.AddItem tempStr
Debug.Print tempStr
End If
'Close the printer handle
ClosePrinter hPrinter
End Sub
Log The Time Of Network Usage And No Of Pages Printed On Win95/98
how to log the time of network (dial up networking or LAN)usage on a computer running win95/98.
Also how to calculate no of pages printed on a printer connected to a computer running win95/98.
can the permission to use a local printer be denied to a user by changing registry settings?
Word: Total Pages
Hi Friends
I am using Word 2000. I'm trying to get the total number of pages in a document thru VBA. Is there any possibility. The current method I'm following is, I will use the GoToPage available in the Word to navigate the pages from 1,2,3..... till there is no error. Then, the final value is the TotalPagesCount. But, is there any other better way? If anyone knows, please pass it to me.
Thanks
Srik
Conditional Counting Total.
Hi,
I have a list in an excel document (A1:A10) that contains variables, which sometimes repeats.
Example:
AA
CC
AA
BB
BB
BB
CC
AA
AA
AA
What I need is a formula that can count how many times each value appears in the list, and in-turns displays it on the Form.
Result Example:
AA - 5
BB - 3
CC - 2
I have no problems opening the excel document, and selecting the range, but am stumped on which formula I can use to display this information on my form.
Any help would be greatly appriciated.
Many thanks,
Daniel.
Counting And Displaying Total No. Of Affected
Greetings Everyone,
Iam a novice in VB and trying to learn. I was attempting to display the result of the total rows in a message box. Iam aware this is possible using Recordset. But I want to know if the same is possible using Conn.Execute. Presently Iam getting Runtime Error:314 Type Mismatch. Iam using VB6 and Access (2003) Database.
----------------------------------------
VB Code:
Private Sub Command1_Click()Dim SQL As StringSQL = "SELECT COUNT (*) FROM Candidates"msgbox conn.Execute (SQL)End Sub
------------------------------------------
Any help would be welcome.
With Kind regards.
PDF - Counting Pages
I am trying to programatically count the number of pages in a PDF but I am getting no where.
Can anyone suggest a way to do it?
Thanks,
Andrew
Calculating Total Pages - Whole Numbers Question
I am stuck on this algorithm and not quite sure how to approach it. My program needs to calculate the number of pages prior to sending it out to the printer. I know that I can use printer.page to get the page number but I need the total pages printed on the cover page. Here is what I have.
The number of records per page is set at 8. So each page contains no more than 8 records. I can get the record count by table1.recordset.recordcount, so I can get the total records. The problem is this.
If I make dTotalPages = table1.recordset.recordcount / 8 and the total records are not divisible by 8 the iTotalPages would contain a fraction if it was a double instead of an integer. So for instance if the record count is 9 then the iTotalPages = 1 So the output would produce 2 pages, 8 on the first page and 1 on the second page. So the dTotalPages should equal 2.
Here is what I have tried.
VB Code:
dim iTotalPages as Integerdim dTotalRecords as Doubledim X as Doubledim Y as Integer 'dTotalRecords = table1.recordset.recordcount 'commented out for testingdTotalRecords = 9 If dTotalRecords < 1 then iTotalPages = 1Else iTotalPages = dTotalRecords / 8 X = val(right(dTotalPages, 4)) if X > 0 then X = 1 End If Y = iTotalPages 'only gets the whole number iTotalPages = X + YEnd If
The resulte is still 1 page and should be 2 pages in this test.
Counting Pages In An XL Sheet
I need to return the current page number to the program. That is the page numbers on the sheet itself as it would print. This seems it should be easily done???? Thanks in advance.
Counting Pages In PDF File
I have a VB 6 project where I need to count the number of PDF files are in a selected directory. Then I need to count how many pages are in each PDF file.
My question is... how do I find out how many pages are in a PDF file?
Has anyone done this, or could someone point me in the right direction?
Any help would be appreciated.
Thanks...
Counting Pages Of A HTML File
Greetings!
Does any of you know for some api code or someting like that for counting pages for an existing HTML file?
The webBrowser or DHTMLEdit Control don't do it (or I haven't find someting about them)
Thanks in advance
[Resolved}DataReport With Sub Total And Grand Total With Out DataEnvironment
rsTotals.Open " SELECT Account_Type, Tax_Type, SUM(Payment)AS Total " _
& " FROM tbl_TransDetails " _
& " WHERE Entry_Date = # " & Date & " # GROUP BY Account_Type, Tax_Type ", _
dbCCP, adOpenDynamic, adLockOptimistic, adCmdText
With rptSumTotals
Set .DataSource = rsTotals
.Sections("Section1").Controls.Item("txtAccounttype").DataMember = ""
.Sections("Section1").Controls.Item("txtAccounttype").DataField = rsTotals.Fields("Account_Type").Name
.Sections("Section1").Controls.Item("txtTaxtype").DataMember = ""
.Sections("Section1").Controls.Item("txtTaxtype").DataField = rsTotals.Fields("Tax_Type").Name
.Sections("Section1").Controls.Item("txtTotal").DataMember = ""
.Sections("Section1").Controls.Item("txtTotal").DataField = rsTotals.Fields("Total").Name
'for sub total
.Sections("Section7").Controls.Item("fnSumTT").DataMember = "" 'rsTotals
.Sections("Section7").Controls.Item("fnSumTT").DataField = rsTotals!Total
'for grand total
.Sections("Section5").Controls.Item("fnGTotal").DataMember = "" 'rsTotals
.Sections("Section5").Controls.Item("fnGTotal").DataField = rsTotals!Total
.Refresh
.Show
giving error: its looking for payment values instead of Total values. so not able to find.
i placed Function control in Group footer section for sub totals and for grand total in Report footer section.
i am not using Data Environment as Data Source.
SQL is good, with out sub and Grand total i am able to print report with Total. after adding Those two function controls i am getting error.
If i assign rsTotals as DataMember "Type Missmatch error"
Help Me, Thanks in advance
>>>>>>>>>>>>>>>>>>>>>>
Edited by - sreddy on 3/24/2005 9:25:02 AM
Character Counting, Line Counting And Saving RTB Files Without Formatting
Hi,
I quickly need to get a bit of help with the 3 things mentioned in the topic title:
Character Counting
When the RichTextBox is changed I want a label's caption to be changed so it counts all characters in the RTB. Not just words, I mean as in each and every letter, space, etc. I searched and search, and found nothing.
Line Counting
I also want, when the RTB is changed, for another label's caption is changed and now says how many lines are in the RTB. I tried doing this myself with getting the label's caption to be +1 for every time enter (vbCrLf) is clicked or used, but that didn't work and properly wouldn't do what I need it to do anyway.
Saving through a RTB without formatting
Basically, when you use the "SaveFile()" Protocol in a RTB it saves, yes, but it has formatting, like so:
Code:
{
tf1ansideff0{fonttbl{f0fnilfcharset0 MS Sans Serif;}}
viewkind4uc1pardlang1033f0fs17 [b]|<b>
par line 2
par line 2
par line3
par
par }
Which isn't what I want it to do, I just want it to save it like a normal text file, no formatting, just text, is there a way to override it's default action to do the above formatting?
Thanks in advanced.
Difficulty
I made a network messager using NET SEND and now i want to make one not using NET SEND...
is it difficult to make a network sender using winsock ?
Difficulty
G'day,
I just wanted to know how difficult it is to use Direct X with Visual Basic. Also, does it require much more programming knowledge? Does its controls come with Visual Basic 6, or do I have to download them? Thankyou for any help.
I also like the colours of this forum!
Phatt
Difficulty With OnTime()
Greetings all!
I am writing a function which will loop constantly. At a certain time each day it will stop (I've got that bit working). At another time each day it will start again. I've got that working when I set the onTime() code myself (ie call the sub that it is run in manually). But when it's being called from the main code it doesn't seem to run. Now, there's an End statement after the call to prevent the loop from continuing, could this somehow be stopping the onTime call?
Anyone have any ideas?
Sorting Difficulty
I have an MS Access table which includes a date column. Before moving through the database I use an SQL command to sort it on the date field. It is necessary for me to select records in reverse order so I then go to the end of the recordset and move backwards.
This works OK if I don't sort the records first but gives an error message 'Rowset does not support fetching backwards' if I do the sort.
I must have the the table in date order prior to selecting records but just cannot find a method which doesn't produce errors. I can't sort within the database so am stumped on how to overcome this.
Any help most welcome.
Timing Difficulty
Hi all,
I am using the data report to display a report.
I have to create the table from a query first, then call the report. (I could not work out how to pass a pram to a query in the report datamember prop of the report)
So i create the table first then call the report, the prob is that the table has not been created before the report is called.
I tried adding a loop to give some time but I think the loop delays the write of the table.
Any suggestions.
deLMCCAG.Commands("Pre_Banking_Rpt").Parameters _
("mvarDate") = txtStartDate.Text
deLMCCAG.Commands("Pre_Banking_Rpt").Execute
Do Until lcount = 500000
lcount = lcount + 1
Loop
Showrep
TA GARRY
String Difficulty
I have the following code that works:
Code:
Private Sub cmdSend_Click()
With Inet1
.Protocol = icFTP
.URL = "xxx.xxx.xxx.xxx"
.UserName = "xxx"
.Password = "xxx"
.Execute , "PUT C:Test.txt Test.txt"
End With
End Sub
However, I have a string problem because the following code will not work:
Code:
Private Sub cmdSend_Click()
Dim strFileHost As String, strFileRemote As String
strFileHost = "C:Test.txt"
strFileRemote = "Test.txt"
With Inet1
.Protocol = icFTP
.URL = "xxx.xxx.xxx.xxx"
.UserName = "xxx"
.Password = "xxx"
.Execute , "PUT " & strFileHost & " " & strFileRemote
End With
End Sub
I would appreciate any help. Thank you.
[Edited by bedowin on 08-24-2000 at 09:31 PM]
Technical Difficulty
In visual basic 6.0, when i try to compile my programs i get an a message from the visual component manager. It says ---
Project failed to build!
method "~" of object "~" failed
does anyone know what this means??? it's really frustrating
thanx for any help
emptywords
OLE Control Difficulty
OLE Control Problem
create a word document of more than 1/2 pages. Save the document in C drive by the name a.doc
Take a OLE control on a from & embed it with a microsoft word document.
on Form load place the following line
OLE1.CreateEmbed "C:a.doc"
Run the application
Double click on the OLE Contol... now u can edit the contents
Go to the end of the document & type something .. & wait for few seconds ... notice the change you are at the top of the document... how come?
can you help us out ..
what we want is to stay there where we were editing the document.
Install Difficulty
I'm trying to create a program that runs off a CD. The program works fine, but I need to have the user have MSMVSVB60.DLL and OLEAUT32.DLL. How can I give the user these files without having to reset the computer. Also I don't want to have an install prog. I'd like it to startup the first time, copy the files, and anyother time, just run the program. Is this possible without a setup and restart? Any help would be greatly appreciated. Thanks.
Pete
Combo Box To Label Difficulty
I have a combo box with the a list of the months of the year
January to Decemeber.
When a user selects say August, I want to populate 4 different labels with the previous 4 months
i.e August in one label, May, June and July in the others.
Obviously populating the month displayed in the combobox is easy but i cant do it for the rest..
These are being used for Captions comparing data from different months.
I was thinking maye there was some way to move down the list using an index method or something???
Any help would be greatly appreciated.
Thank You
Pat
Difficulty With Writing A VB Code
I'm just a beginner with VB and our teacher had already given us a big project to work on. I'm having difficulty writing a program that would accept an input for your birthday (month, year) and tell you your zodiac sign.
Difficulty Parsing Strings.
I can't figure this out...
I wrote something to remove a string that's inside another (larger) string.
With the text
Code:
text<text>text
This will parse the text correctly.
VB Code:
Text = RemoveEm(Text, "<", ">")
But, how can I keep those delimiters ("<" and ">") inside the string?
If I don't subtract 1 from a and don't add 1 to b, it just doesn't do anything.
VB Code:
Public Function RemoveEm(Text As String, DelimiterA As String, DelimiterB As String, Optional ReplaceWith As String = vbNullString) As StringDim a As Long, b As Long a = InStr(Text, DelimiterA) b = InStr(Text, DelimiterB) Do Until a = 0 Or b = 0 Text = Left$(Text, a - 1) & ReplaceWith & Mid$(Text, b + 1, (Len(Text))) a = InStr(Text, DelimiterA) b = InStr(Text, DelimiterB) DoEventsLoop RemoveEm = TextEnd Function
Searching Through Listbox :: Have Tried With Difficulty
Hi, I have a listbox (userlist) which is full of usernames. I want my code to loop through each item in the listbox checking it against a search term that the user will enter.
My code currently finds the number at which all the found search terms reside but I don't know how to then assertain which listindex this number is in and then display the full username is a seperate box. (text1.text) (Not just the term searched for.
At the moment my code acts strangely and I don't know eher to go from hereGoes through the list assigning each list item to a string (cumulstring)I then use the Instr() function to compare each item with the search termIf found any where in any item, my code returns the number at which that letter was found
I really do need some guidance. Thankyou
My code is as follows:
Code:
Private Sub finduser_Click()
Dim searchstring As String
Dim listamount As Integer
Dim cumulstring As String
Dim analyse As Integer
Dim startpoint As Integer
Dim searchlen As Integer
Dim i As Integer
Dim sItems() As String
searchres.Visible = True
cumulstring = " "
analyse = 1
startpoint = 1
listamount = userlist.ListCount
searchstring = InputBox("What would you like to search for?", "Search for contact")
searchlen = Len(searchstring)
For i = 0 To (listamount - 1)
userlist.ListIndex = i
If (cumulstring) = " " Then
cumulstring = cumulstring & userlist.List(i)
Else
cumulstring = cumulstring & "," & userlist.List(i)
End If
Next i
Do Until analyse = 0
If analyse = 1 Then
Exit Sub
End If
analyse = InStr(startpoint, cumulstring, searchstring)
MsgBox (analyse)
startpoint = analyse + 1
Loop
sItems() = Split(cumulstring, ",")
Text1.Text = sItems(2)
End Sub
I don't know where to go from here to create what I have mentioned.
Difficulty In Loading Project
What could be the reason that I get this error msg when I tried loading my VB project?
'C:my documentsVBprojIEINF05.0CX' could not be loaded. --- COntinue loading project?
Pls advise
Thank You.
1 Medium-difficulty Mdi Quesion
I am not happy with the normal mdi form. I want the mdichild to align to the right, but I cant find how to do that. If you know how, tell me. But since I dont know, I was wondering if you could make your own mdi form. I know how to setparent so form2 is inside form1, but thats flickery. Can you get around that?
Difficulty Clearing Cache
Hi, this is really a two part question. The first part is that if I navigate to a URL twice with an AxWebbrowser control, the second time it just loads the page from cache. I would love to get around that. So I tried the following without luck:
' JUST FOR EXAMPLE, I ONLY WANT TO REMOVE TEMP .HTML FILES THAT HAVE THE WORD "microsoft"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RemoveFiles("microsoft", Environment.GetFolderPath(Environment.SpecialFolder.InternetCache))
End Sub
Private Function RemoveFiles(ByVal SubstringForFileName As String, ByVal Directory As String) As Boolean
Dim Dirs(), Files() As String
Dim DirIndex, FileIndex As Integer
Dim FileObj As IO.File
Dim FilePathAndName As String
Dirs = System.IO.Directory.GetDirectories(Directory)
For DirIndex = 0 To Dirs.Length - 1
Files = System.IO.Directory.GetFiles(Dirs(DirIndex))
For FileIndex = 0 To Files.GetUpperBound(0)
If SubStringExists(Files(FileIndex), SubstringForFileName) Then
FilePathAndName = Files(FileIndex).ToString()
FileObj.Delete(FilePathAndName)
End If
Next
Next
End Function
The problem is that when I view the Temporary Internet Files directly, I see the temporary .html files I want to delete. However, when I step thru this code it is finding files that are from some other folder. Very confusing. Any help would be greatly appreciated.
Charles
I Am Having Difficulty Using Data Environment In VB6
I am having difficulty using Data Environment in VB6
I have set the textboxes in the program is set to work with DE
like:
txtName.Data Source = DE.connection
txtName.Data Member = DE.rsEmp
txtname.Data Field = "Name"
It works fine with movenext and moveprevious
But after I have assigned SQL statment to DE.rsEmp like:
DE.rsHorn.Open "Select * From tbl_Emp where Id = blablabla
and open DE.rsemp again it opens BUT the textboxes does not synchronize with movenext and moveprevious
The textboxes are not updated unless i manually pass the recordset values one by one to these textboxes
like:
txtName.text = DE.rsEmp (1)
Please Help me solve this problem
Script Having Difficulty With Path Designated. Help Please.
Below is a script I worte to execute the a10bills.dtf program. It works if I do not include the path name (commented out below). I want to include the path name as I need it for another situation, but I can't seem to get it to work.
*************************
set ws = wscript.createobject("wscript.shell")
ws.run("H:ProjectsScriptsPB File DownloadPreprocessor Input"A10bills.dtf"",0,"true")
'ret = ws.run("A10bills.dtf",0,"true")
If ret = 0 then
wscript.echo "No Error"
Else
wscript.echo "error"
end if
***********************
So any suggestions on this one?
Thanks!
Difficulty Adding Menu Items
Can anyone point me in the right direction?
I am trying to add one Button/Event/Caption to the &Tools control of the Standard Command Bar (menu bar) in MSWORD. When the user clicks this button, I want to run the macro titled "Main"
I think I know how to create the control, but I do not know how to put it where I want it. I am writing this in VBA in WORD 2000
Code:
Sub quick()
Dim CTemp As CommandBarControl
Set CTemp = Application.CommandBars("Standard").Controls.Add(Type:=msoControlButton, Before:=1, temporary:=True)
With CTemp
.Caption = "CAR"
.DescriptionText = "Consolidate Raw Text into Form"
.OnAction = "Main"
.Enabled = True
.Visible = True
End With
End Sub
Difficulty Figuring Out Range Object
This works:
Code:
Cells(1, 1).Select
Do Until ActiveCell.Value = ""
If ActiveCell.Value = ActiveCell.Offset(1, 0).Value And ActiveCell.Offset(0, 6).Value = ActiveCell.Offset(1, 6).Value Then
Rows(ActiveCell.Row).Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
This doesn't:
(causes runtime error 1004: application-defined or object-defined error)
Code:
Dim WS as Worksheet
Dim Rng As Range
Set Rng = ActiveCell
Cells(1, 1).Select
Do Until Rng.Value = ""
MsgBox Rng(1, 0).Value
If Rng.Value = Rng(1, 0).Value And Rng(0, 6).Value = Rng(1, 6).Value Then
Rows(Rng.Row).Delete
Else
Rng(1, 0).Select
End If
Loop
Why? Help, please? I'd really like to be able to type "rng" instead of "activecell.offset" when writing code.
Difficulty Linking VB To Command Prompt
Hi, I have an error in my vb program linking to batch file running in command prompt. If i run the batch file by manually double clicking it, the command prompt is able to process the batch file. However, I am got an error when i run the batch file by linking from vb. Can you guys help me with my problem asap? Thank you very much!
Coding:
retval = Shell("cmd /k C:Program FilesPrivyLinkSLIFTClassic1.4 est.bat", 1)
What the command prompt shows:
'C:Program' is not recognized as an internal or external command, operable program or batch file.
|