About Validation On "mm/yyyy"
Hi there. I got the following vba codes to validate whether a period keyed in by user is valid. (e.g 'mm/yyyy' check if 02/2004 > 01/2005)
Code: Private Sub CommandButton4_Click() Dim ad1 As Date Dim ad2 As Date ad1 = CDate(TextBox1.Text) ' 02/2004 keyed in by user as the month "from" ad2 = CDate(ListBox1.Value) '01/2005 selected from listbox as the month "to" TextBox3.Value = Format(ad2, "mm/yyyy") If Format(TextBox1.Value, "mm/yyyy") > Format(TextBox3.Value, "mm/yyyy") Then MsgBox "Invalid period specified for the report! Press 'OK' to try again...", vbCritical, "Wrong Data Entry" TextBox3.Value = "" ListBox1.ListIndex = -1 Exit Sub End If End Sub
However, when 02/2004 was keyed in as the month 'From' and '01/2005' as the month 'To'. the specified error message popped up for an invalid period, that means 02/2004 is later/greater than 01/2005!!
What's wrong with my codes?
Cheers.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
- Renaming Database To "Archive-"Date(mm-dd-yyyy)
- Sorting Of Dates With Format "dd/mm/yyyy"
- Date Picker Format "dd/mm/yyyy"
- If I Use "SaveSetting App.Title, "Settings", "Font", "001122"" - Save Date In The Registry, Where Ca
- Format(string,"mm/dd/yyyy")
- Solution> Error: """"&&H8007007E (-2147024770) The Specified Module Cannot Be Found"""
- Method "SaveAs" Or "Save" Of Object "Excel.Workbook" Does Not Work.
- How To Replace "Apple" With "Banana" In A String That Contains "Orange" In A TXT File
- Data1.RecordSource = "select * From Salary Where 姓名 Like " + S + " " * ""
- How To Change Boolean Field From Displaying "0" And "-1" To "Yes" And "No"
- Set Validation Rule To "Is Null" Programatically
- Extract Local Names For "OK", "Cancel" And "Apply"
- <input Type="submit" Name="op-savefile" Value="Save"> - How To S
- Disabling "wake Up", "sleep" && "power" Button
- Pleez, Read This!!! Matter Important! "Printing In "DOS Mode" Using "Shell" -not Happening, I Wonder
- Less "Extreme" Data Validation
- Need To Set Field With Validation Mask To ""
- Getting The File "Type" Descriptions (i.e., "doc" = "Microsoft Word Docume
- Changing The "title" Of A VB Created Word Doc From "Document1" 2 "BadgerBai
- Resubmitting: "BeginTrans" , "CommitTrans" And "Rollback With Data Environments
- Can Someone Guide Me On How To "PUT" A "CHECKBOX" Inside A "Datagrid" For VB6.0?
- Combobox Help """""""""""""'Urgent"""""""&&quo
- "BeginTrans" , "CommitTrans" And "Rollback With Data Environments
- "date" Validation
- Validation For A "POST CODE OR ZIP CODE" Textbox In Visual Basic
-
Export Table From MS Access To Outlooks Contacts "Standard Field" - With Conatct Item "Notes"
- Inverted Commas In String "etc" && Variable && """
- Creating Program "item" In Existing Start Menu "group"
- How To Change All Cells Format Type From "General" To "Text" Using VB Code
- How To Reach Each File In A Folder In Order? With "FileSystemObject" - "Files" Class.
- Emulating The "APPLY" Button Within The Appearance Options "Refresh The New Settings"
- Msgbox "text", VbOKOnly, "Title" Remove X In Upper Right Corner
- A Stupid Problem: "Error Accessing The System Registry" ("Solved") Thank You
- EnumWindows AddressOf EnumWindowsProc, 0 "Syntax Error"</title>
<script Type="text/javascript">
<!--
Function PrintTags() {
Var Curr=document.getElementById('vB_Editor_QR_textarea').value;
- Why Can't Create "Excel.Application" Object Using "CreateObject" Function
- VBcode In Excel For "print" And "Exit" Command Button
- Access.CommandBars.Item("BarName").Controls("ButtonLabel")
- Problem With MySql And "Blob" And "Text"-Fields [DAO/ODBC]
- How To Get Path To User's "My Documents" When Running A "System" Process?
- Ending Service Started From "Shell Environ$("comspec") "
- Get Value Of "System Idle Process" In "Windows Task Manager" ?
- Adding New Item To "Look In"/"Save As" Combo Box In Common Dialogs
- How To Export An "image File" And "MSFlexGrid" To A Word Document
- How Do You Make A Program Where Your Built-in Words Like "hey" Or "blah" Go In Order?
- "mDoc.getElementById("menu").innerHTML = S" Doesn´t Work! 'PLEASE Help!!!!!!!
- Fast && Efficient "BMP" -> "Compressed Image" Converter Code
- How To Create A "Back" And "Forward" Button For The Web Browser Control
- Where To Download "DirectStudio98" Of Arakelian Soft And "ActiveX For VB" Of TegoSoft?
- How To Remove Word Document Metadata "author" And "Last Saved By"
Sorting Of Dates With Format "dd/mm/yyyy"
Hello. I got the following code to have the dates (dd/mm/yyyy format) in ascending order but to no avail.
Code:
fd = CDate(TextBox1.Value)
az1 = Cells(Rows.Count, 2).End(xlUp).Row
Range("b" & az1 + 1).Value = Format(fd, "dd/mm/yyyy")
Range("b:b" & az1).Select
Selection.Sort Key1:=Range("b2"), Order1:=xlAscending, Header:=xlGuess, _OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
The code seems not able to sort the dates in ascending order as expected. What did I miss?
Thanks.
Date Picker Format "dd/mm/yyyy"
Hi all,
how can i set the format of date of datepicker to
"dd/mm/yyyy" format. i have tried the format &
customised format of datepicker but not worked out
thanks & rgds
rajeev
Format(string,"mm/dd/yyyy")
I neee help?
I have a string in my db 'SheetIDFK' which = 0222200701
I use....
Date1 = Mid$(rsd!SheetIDFK, 1, 8)
then date1 = 02222007 - this is good
if i use Date1 = CDate(Mid$(rsd!SheetIDFK, 1, 8))
or Date1 = format(Mid$(rsd!SheetIDFK, 1, 8), "mm/dd/yyyy")
VB says that Date1 = 2/16/7874
Does anyone know what is going on?
I hate dates
Method "SaveAs" Or "Save" Of Object "Excel.Workbook" Does Not Work.
Hi people.
I did for a long time a program that uses excel automation, so that from a template will create a final file with some data pulled from the database (with ADO). At the end and when the Excel file is ready to be saved I got in a couple of computers some problems. In the whole LAN have XP, but in these 2 computers we have SP2. I have checked the rights and are OK (I have even tried to save the Workbook under the Temp folder and also the same problem).
Working with Office 2003 (SP1).
I have searched in internet about any bugs but I don´t find anything.
Any ideas.
Thanks for your time
Jaime
How To Change Boolean Field From Displaying "0" And "-1" To "Yes" And "No"
Hey there,
I have a data report, which displays a few fields from an Access table, one which is a boolean. At the moment if the boolean value is True, then on the data report it displays "-1", and if False "0".
How can I change this so it displays "Yes" if true and "No" if False?
Would be really grateful for any help.
Thanks.
Set Validation Rule To "Is Null" Programatically
My .txt file contains null fields. When I create a new table in MS Access I need to set the validation rule for a particular field to "Is Null" The code below allows me to change field formats to "number" in which case I'm unable to import null fields.
Toward the bottom the following line will be equal to "Is Null"
rsMain.Fields(intLoop - 1).Value = Trim$(Mid(strLine, 1, intFound - 1))
When this happens I receive a data-type conversion error in that string. I've listed the entire module for running, but really only need to add validation statement after CREATE TABLE.
Private Sub ImportASCII()
Dim dbMain As Database
Dim rsMain As Recordset
Dim intFound As Integer
Dim strLine As String
Dim intLoop As Integer
Dim strFields As String
Dim lngFileLen As Long
Dim lngProgress As Long
lngFileLen = FileLen(ASCIIFileName)
Set dbMain = OpenDatabase(AccessFileName)
On Error Resume Next
'Compile field information
strFields = ""
For intLoop = 1 To UBound(aryNameAndType)
strFields = strFields & aryNameAndType(intLoop, 1) & " " & aryNameAndType(intLoop, 2) & ", "
Next intLoop
strFields = Mid(strFields, 1, Len(strFields) - 2)
strFields = Replace(strFields, "AUTONUMBER", "COUNTER")
dbMain.Execute "CREATE TABLE " & AccessTableName & "(" & strFields & ");"
'Now import the text file into the new database
Set rsMain = dbMain.OpenRecordset(AccessTableName)
Open ASCIIFileName For Input As #1
'Remove first row if it contains field names
If chkFirstRow.Value = 1 Then
Line Input #1, strLine
End If
On Error Resume Next
Do While Not EOF(1)
Line Input #1, strLine
'Remove text qualifiers
If InStr(strLine, cboQualifier.Text) <> 0 Then strLine = Replace(strLine, cboQualifier.Text, "")
lngBytes = lngBytes + Len(strLine)
rsMain.AddNew
For intLoop = 1 To Len(strLine)
intFound = InStr(strLine, strDelimiter)
If intFound = 0 Then
rsMain.Fields(intLoop - 1).Value = Trim$(strLine)
Exit For
End If
rsMain.Fields(intLoop - 1).Value = Trim$(Mid(strLine, 1, intFound - 1))
strLine = Mid(strLine, intFound + 1)
Next intLoop
rsMain.Update
DoEvents
Extract Local Names For "OK", "Cancel" And "Apply"
Hi!
I noticed that some programs written in C++ have an English language, but the captions of the buttons "OK", "Cancel" and "Apply" are in German, Swedish or whatever localized Windows version the user utilizes. Any idea how to obtain the captions of those buttons in VB? The only method which comes into my mind is to get the locale ID and have an array with strings for the the various language versions, but I doubt that those programs do it in that way.
Regards,
Sebastian
Pleez, Read This!!! Matter Important! "Printing In "DOS Mode" Using "Shell" -not Happening, I Wonder
Hi
[I had to repost it since I have not received any replies for my earlier post]
I have a problem.
Following is the code :
Shell("c:windowscommand.com /c type " & App.path & "matrix.txt >prn")
where App.path is C:XYZ
when the above line is executed, the contents of "matrix.txt" is not printed on the printer. Instead, control just passes on to the next line.
So, to find out why, I modified the line thus.
Shell("c:windowscommand.com /K")
The above command takes me to the "command prompt". Here, when I give the command "type c:xyzmatrix.txt >prn", which is what the vbcode does, I get the message "file creation error".
So, I have identified the problem. Can anyone tell me why this "File creation error" occurs, And how to solve the problem?
Thanks for reading through.
Less "Extreme" Data Validation
I have a data validation example in the Excel FAQ thread that uses a macro to allow the data validation in one cell to be dependent on a choice in another cell.
In other words, depending on which item I select in Cell A2, the validation list in Cell A3 will change. Here's the link to that post:
http://www.xtremevbtalk.com/showpost...74&postcount=4
I have recently found an easier and cleaner way to do this same thing.
I have attached a screen shot that shows how to do it. It uses the Indirect function in the validation, and it also requires that some ranges be given appropriate names.
See the screenshot for the details.
I found the idea for it here:
http://www.dicks-blog.com/excel/user...ace/index.html
Need To Set Field With Validation Mask To ""
Hi All,
One of the fields in my access database has the following validation rule 00/00/0000;0;_ (Date format - 12/07/2002)
The problem is when I try to clear this field (e.g. put in "" or __/__/____) at run-time I get "This action was cancelled by the associated object". I am 99% sure it stems from the validation rule. Is there any way I can empty out this field at runtime?
Thanks in advance,
Getting The File "Type" Descriptions (i.e., "doc" = "Microsoft Word Docume
Hello there,
I am creating an Explorer-type Listview to display the files in a directory, and one piece of info I need to know how to obtain is the file "type" (i.e., "doc" = "Mircosoft Word Document", "xls" = "Microsoft Excel Worksheet", etc.). Is there an API, or does anyone have a technique to do this? Thanks.
Changing The "title" Of A VB Created Word Doc From "Document1" 2 "BadgerBai
Ok, when I create a new word doc it automatically takes on the name "DocumentX", where X is a number greater than 1.
What I want to do is change this by using something like:
VB Code:
Dim objWoof As New Word.ApplicationDim objGrowl As Word.Document Set objGrowl = objWoof.Documents.Add objGrowl.[What Property] = "Badger Baiters R Us"
Is this possible?
Oh, and b4 anyone mentions it, I do NOT want to save it, that is NOT an option...just getting that out the way now
Rarararrrrrrrrr
Woka
Resubmitting: "BeginTrans" , "CommitTrans" And "Rollback With Data Environments
----- Original Message -----
From: shankar [ babu ]
To: visualbasic-l@OpenITx.com
Sent: Wednesday, February 26, 2003 12:24 PM
Subject: "BeginTrans" , "CommitTrans" and "Rollback with dataenvironments
hello everybody,
I am using data enviroment designer in my project.
I am getting error while using
"BeginTrans" , "CommitTrans" and "Rollback"
of the DataEnvironment 's connection properties
kindly let me know the solution
thanks in advance
bye
shankar
Combobox Help """""""""""""'Urgent"""""""&&quo
Hi Guys,,,,,,
This may be the stupid way.But i need this.................
I am using combobox in my form. I set the style to Dropdown combo.
Here we can exter text in combobox b'coz of the style Dropdown combo.
But i don't want to allow user to enter ......allowed only to select.....
For that i can set the style to Dropdownlist.
But i don't want this style. B'coz i can't clear the text at run time.
Tell me if dropdown combo means, User shouldn't enter at runtime
Tell me if dropdown list means, how to clear the text at runtime...
Pls help me out.....Urgent
sangeetha
"date" Validation
strTest_Date = "30/02/2004 " - invalid date
strTest_Date2 = "25/08/2004" - valid date
How to validate strTest_Date in VB?
Thanks,
vb999
Validation For A "POST CODE OR ZIP CODE" Textbox In Visual Basic
Hello,
I am having trouble Disabling some characters for a post code or zip code textbox in Visual Basic. Can somone please supply me with some visual basic code help that only allows the user to enter numbers within the range. A code that disables letters, some numbers that are not in the range of a Zip Code or Post Code.
Thanks
God Bless
telosshailot
Inverted Commas In String "etc" && Variable && """
I need to include a double inverted comma in a string, here's some more detail...
MsgTitle = "RaceControl 2003"
MsgText = "Enter password."
rcvarValueString1 = InputBox(MsgText, MsgTitle)
rcvarValueString2 = "MS Access;PWD=" & rcvarValueString1 & """
Set dbRacecontrol = OpenDatabase("RaceControl2003.mdb", False, False, rcvarValueString1)
The last part of the Set statement needs to read "MSAccess;PWD=password" including the double inverted commas (where password is the password for the database). However, I want to make the user type in the password... I suppose what i've done so far is correct, but I don't know how to include the double inverted commas in the variable rcvarValueString2. The rest of the Set statement is definitely correct.
Thanks in advance,
Mat
Creating Program "item" In Existing Start Menu "group"
Hi all,
I'm finally at the stage of packaging my application for distibution here at work. When it installs, I don't want it to create a new group in the start menu rather I want to ADD it to an existing group. All of our essential programs go in to a group called "Desktop Applications". During the P&DW, I created a new Group under Programs called "Desktop Applications" and put the program item under that group thinking it would recognize it as an existing group and just add it. Well, apparently I did something wrong because it doesn't add it to this group, nor does it add it anywere else.
Does anyone know how to do this?
How To Change All Cells Format Type From "General" To "Text" Using VB Code
Hi Guys,
I am new to VBA. If you see my code below, it gets the name from user to insert a new sheet into existing work book. Now, when I create this new worksheet, I want to change their all cells format from "General" to "Text". In that case, whatever I add it is saved as "text" not number or general.
How can I do that? Please help me.
Code:
On Error Resume Next
Dim count As Integer
If txtNewSheet.Text <> "" Then
wbDpiFavorites.Sheets.Add
' Get the sheet with the name selected in the Sheet combo box.
Set shtFavorites = wbDpiFavorites.Sheets.Item(1)
shtFavorites.Name = txtNewSheet.Text
cmbSheet.AddItem shtFavorites.Name
cmbSheet.ListIndex = cmbSheet.ListCount - 1
wbDpiFavorites.Save
Set shtFavorites = Nothing
End If
How To Reach Each File In A Folder In Order? With "FileSystemObject" - "Files" Class.
I know that I can reach any file(or filename) by using FileBox control with
Code:
'I can choose any file with its index. The Files are sorted by their names
File1.List(FileIndex)
I want to do the same without using FileBox control, else I tried to reach Files
with
Code:
Dim fso As New FileSystemObject, fil1 As File, fol1 As Folder, fc As Files
Set fc = fso.GetFolder(sFolderPath).Files
MsgBox fc.Count
'Nothing wrong up to here
'but this line gives error
MsgBox fc(1).name
I figured it out that
Code:
Msgbox fc(index) 'is wrong
Msgbox fc(key) 'this is the right one
So what is key here?
And Is it possible to reach each file with in order(as sorted by names)
(ex: I want to access the 6. file or 3. file) with FileSystem Object?
Ofcourse any other ideas will be wellcome.
Emulating The "APPLY" Button Within The Appearance Options "Refresh The New Settings"
Hi Guys,
I'm needing some help with this one. I've got a copy of the HKCUControl Panel hive and need to apply this to the registry and then "apply" the changes. The problem lies with "refreshing" the registry so that the changes apply.
Here's an example:
1. Open Regedit and change the following key = HKCUControl PanelColorsBackground to 0 0 0 (black, or any choice of color!) and close regedit.
2. To apply the changes, a user needs to log off and then back in. This is no good.
I've tried running TSKILL explorer.exe but this does not help either..
Any help would be great.
A Stupid Problem: "Error Accessing The System Registry" ("Solved") Thank You
This is a very silly problem. I tried to have a look of References from Project dropdown menu, it returned a critical error:
"Error Accessing the system registry".
I reinstalled VB6 but it seems that the problem still exists. Anybody please tell me how to solve the problem.
thanks in advance
Edited by - kenyiwei on 5/6/2004 2:07:51 AM
EnumWindows AddressOf EnumWindowsProc, 0 "Syntax Error"</title>
<script Type="text/javascript">
<!--
Function PrintTags() {
Var Curr=document.getElementById('vB_Editor_QR_textarea').value;
I get "Syntax Error" when i put this code in to a button. Whats wrong?
EnumWindows AddressOf EnumWindowsProc, 0
______________________________________________________________________
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim Length As Long
Dim sName As String
Dim Temp As String
Static iCount As Integer
iCount = iCount + 1
Length = GetWindowTextLength(hwnd) + 1
If Length > 1 Then
sName = Space(Length)
GetWindowText hwnd, sName, Length
If Left(sName, Length - 1) Like "Order*" Then MsgBox "window found!"
End If
EnumWindowsProc = 1
End Function
Why Can't Create "Excel.Application" Object Using "CreateObject" Function
Hi there,
I try to create an "Excel.Application" object using CreateObject function, I got "nothing" from the return variable without any error messages, but It works well on another machine that it has same environment settings(include same references setting) on those 2 machine: Win2k/Sp4, VB6/Sp5, Mdac_type2.7, the following is source code snippet:
Public appWorld As Excel.Application
Public wbWorld As Excel.Workbook
Sub Setup()
On Error Resume Next 'ignore errors
Set appWorld = GetObject(, "Excel.Application")
If Err.Number <> 0 Then
Set appWorld = CreateObject("Excel.Application") 'run it
End If
Err.Clear
End Sub
I got "nothing" from "appWorld", even I remark all of error handle lines, the same result I got, pls help,thanks!
ps: you could reply me to : frankie@sompojapan.com.hk
VBcode In Excel For "print" And "Exit" Command Button
I am a new face here, I wonder is there any one could help me to solve the problem by using vb.
I add two command buttons in excel, one for print the document, another one for EXIT the application,but I could not find out the VB source code of doing them.
Hope someone can help me!
Access.CommandBars.Item("BarName").Controls("ButtonLabel")
Ok, im having some trouble to enable and disable a button in my menu, the problem is that i dont know how to find him in a command line..using access 97.....sample:
The menu is:
ButtonLabel/Records/Insert (Its a tree menu)
Disabling the main button is easy, something like:
Code:
Access.CommandBars.Item("BarName").Controls("ButtonLabel").Enabled = false
But how to disable a button inside the menu.....?!? Tks in advance
Problem With MySql And "Blob" And "Text"-Fields [DAO/ODBC]
Hello,
I use DAO/ODBC to connect to MySql... I can open Recordsets and retrieve the content of fields, but I can only move forward inside of the recordset (no MoveFirst, MoveLast, etc.)...
I also can get the content of a 'Text' or 'Blob'-Field only for one time... When I use xrec.Fields("testfield") for the second time, it is empty...
I am using MyODBC 3.51
How To Get Path To User's "My Documents" When Running A "System" Process?
My program generates PDF files through a postscript printer driver. The UI portion of the code is called from my Port Monitor which makes it a "SYSTEM" process (ie not one started by the user).
When trying to access the path to "My Documents", I get "C:Documents and SettingsLocal Service" which is not the user's directory.
Tried:
various API Calls, environment variable with the same answer. Obviously I searched this forum at nauseum, The API guide and this forum.
My Options (as far as I can see right now):
Registry: HKEY_CURRENT_USER/Volatile Environment/HomePath or File searching through "C:Documents and Settings" for recent files to guess at who might be the current user. Frankly, I am not happy at either of these.
Am I missing something obvious? Thx a lot to anyone with suggestions.
Ending Service Started From "Shell Environ$("comspec") "
Hi Everyone,
I am trying to figure out how to close the single instance of the cmd.exe process that is started when I run the below line of code.
Each time I run my program, another instance of the cmd.exe process is left running in my processes. I do not wish to kill every instance cmd.exe because I may be working on something in another cmd.exe process that I do not want to loose.
Is there anyway for my to run the below code then have the process end as soon as it finishes?
Thanks!
VB Code:
Shell Environ$("comspec") & " /k net view > C:view.txt", vbHide
Get Value Of "System Idle Process" In "Windows Task Manager" ?
Hello,
Is their any way to get the "System Idle Value" the same value that we see in the "Windows Task Manager"
I need this value for my program, if this value is around 90 or above , my program can start , if it is below , I will put a message telling "That he need more resources" or something like that.
Thank you for your help
Best Regards,
Didier.
Adding New Item To "Look In"/"Save As" Combo Box In Common Dialogs
I am trying to integrate a COTS document management software into Windows in order to provide integration for all Windows apps. To do this, my proposed design is to add a new item in the Look In/Save As dropdowns in the common File Open/Save dialog boxes. Typically, the items in the control are drives and folders, however my item will be a link to a DLL control that will process the open/save request through the DM system via API tools.
I have seen this done with another DM package years ago (WinNT) so I know it can happen, but not sure where to begin. I'm not looking to modify the actual common dialogs, rather I need to know where and how the Save/Open dropdown control gets the items.
Any insight or code will be rewarded handsomely!
How To Export An "image File" And "MSFlexGrid" To A Word Document
I need to output an image file and a table (MSFlexGrid) to WORD, anyone can suggest how to do ?
I use the following to output text fields:
========================================================Private Sub cmdPrtProductionSheet_Click()
Dim objWORD As New Word.Application
Dim objDoc As New Word.Document
Set objDoc = objWORD.Documents.Open("C:PPSheet.doc")
objDoc.FormFields.Item("clientcode").Range = strClientCode
objDoc.FormFields.Item("factorycode").Range = txtFactoryCode
objDoc.FormFields.Item("PPNO").Range = strPPNO
objDoc.FormFields.Item("PDate").Range = strIDate
objDoc.FormFields.Item("EDate").Range = strEDate
objDoc.FormFields.Item("ContactNo").Range = strSONO
objDoc.FormFields.Item("StyleCode").Range = txtPPStyleCode
objDoc.FormFields.Item("BulkQty").Range = txtPPBulkQty
objDoc.FormFields.Item("Quota").Range = txtPPQuota
objDoc.FormFields.Item("description").Range = txtPPStyleName
'objDoc.FormFields.Item("imagefile").Range = LoadPicture(iFile)
objDoc.SaveAs ("C:PPSheet_" & strPPNO & ".doc")
objDoc.Close
Set objDoc = Nothing
Set objWORD = Nothing
End Sub
Thank you in advance
"mDoc.getElementById("menu").innerHTML = S" Doesn´t Work! 'PLEASE Help!!!!!!!
I have a html document with two iframes in and I want to write in an new html document that is encypted in the iFrame that has the id="menu". The new html document have a read in from a file and decrypted it and load it in to a variable s. I have try the vb code down below but i get en "Run-time error 600" "Application-defined or object-defined error. Could any one help me? I want to take the content that is in "s" (html-code) and load that in the iFrame "menu"
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="CSS/base.css" type="text/css">
<script type="text/javascript" language="javascript" src="Javascript/base.js"></script>
</head>
<body onLoad="javascript:init()">
<div id="globalcontainer">
<div id="header">
<ul>
<li id="current"><a href="#" onClick="activateTab(this.parentNode, 'home')">Home</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'channels')">Channels</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'diagnosis')">Diagnosis and treatment</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'glossary')">Glossary</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'needling')">Needling</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'pointCat')">Point categorie</a></li>
<li><a href="#" onClick="activateTab(this.parentNode, 'pointindex')">Point index</a></li>
<!--<li><a href="#" onClick="activateTab(this.parentNode, 'methods')">Point selection methods</a></li>-->
</ul>
</div>
<br style="clear:left"/>
<span class="style1"></span>
<div id="box">
<iframe name="menu" id="menu" width="595" height="100" src="Menu/mHome.htm" frameborder="0"></iframe>
</div >
<div id="view">
<iframe name="show" id="show" src="data/home.htm" width="595" height="475"></iframe>
</div>
</div>
</body>
</html>
This is the VB-Code that i try with
VB Code:
Dim s As string Set mDoc = WebBrowser1.Document Set txtStream = mFso.GetFile("C:akuSourceMenumChannels.htm").OpenAsTextStream(ForReading) s = txtStream.ReadAll mDoc.getElementById("menu").innerHTML = s
This is all the VB code in the sub
VB Code:
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, _ Headers As Variant, Cancel As Boolean) Dim Ev As String Dim txtStream As TextStream Dim strElement As String Dim i As Integer Set mDoc = WebBrowser1.Document If UCase$(Left$(URL, 6)) = "EVENT:" Then 'this is our event, process it and cancel navigation Ev = UCase$(Mid$(URL, 7)) Call MsgBox(Ev) Select Case Ev Case "HELLO" MsgBox "Hello from VB App" 'set a field on HTML page WebBrowser1.Document.All("field1").Value = _ "Hello from VB" Case "CLOSE" If MsgBox("Are you sure you want to exit?", _ vbYesNo) = vbYes Then End End If Case "CHANNELS" Set txtStream = mFso.GetFile("C:AkupunktörAkupunktör_klientSourceMenumChannels.htm").OpenAsTextStream(ForReading) s = txtStream.ReadAll Dim frames As HTMLElementCollection Dim frame As HTMLIFrame 'Set frame = mDoc.getElementsByTagName("iframe") 'WebBrowser1.Document.getElementById ("box") 'For Each frame In frames ' If frame.Name = "box" Then 'Set getMainWindow = frame 'Exit For ' Call MsgBox("Hej") ' End If ' Next Dim strOuter As String Dim o, oFrame As Object Set o = mDoc.frames ' For i = 0 To o.length - 1 ' Debug.Print "Frame:" & i & o(i).Name ' Set oFrame = o(i) '' Debug.Print "Frame:" & i & oFrame.Name ' Next i 'mDoc.frames(0).innerHTML = s mDoc.getElementById("menu").innerHTML = s 'MsgBox (mDoc.getElementsByName() ' myFrame.innerHTML = s 'WebBrowser1.Document.getElementById("menu").innerHTML = s 'Call MsgBox(mIframe) End Select Cancel = True End If End Sub
Fast && Efficient "BMP" -> "Compressed Image" Converter Code
Since now that my scren capturing program is working the way it's suppose to, I'll keep the issue seperate.
I just need a converter that can be used in a timer and not drain the system resources. Like a simple function without all the hassel of adding classes and subs into modules and then calling the primary DLL that does the compression.
Bmp2Jpg.dll drains my resources so this is why I'm asking for something better or the raw code to actually compress BMP's to JPG (Binary open, Ubound, etc.)
Any help?
How To Remove Word Document Metadata "author" And "Last Saved By"
hi all
I want to remove meta data of a ms word document.
I m able to do that. but my problem is as i save it after removing meta data value, its again saving the time and author name, that is me as user. so i do not want to keep author name and last saved by and time.
and one more question is
can i get meta data without opening (Programmaticaly) word document.
please help
meena
|