Archive PPT-Save A Copy With Todays Date, If Doesnt Exist Already
I want to make a macro that will check a certain directory for a file with a filename like:
Presentation-20-09-2007.ppt
If the file for todays date doesnt exist, it saves the current presentaion with the proper date in the filename.
Is that possible?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Checking For Date In Access File And Compairing It To Todays Date...
Hey all, i am stuck at this point in my program.
I need the program to load up my access table and check for the date of orders:
each record has a field called PickUp and its formatted like "sat 1/1/2004".
When the form loads up, i need it to check that field and the computers date and if its the same, place the record into the list view. Keep going down the list til EOF.
Any help would be great.
Thanks for your time,
David
Still Having Probs With Select Statement Where Date = Todays Date
Hi Guys
I am using vb6.0 connecting to a SQL database (runningMSDE)
I am trying to load all contacts where the recontactdate is today
I have tried the following but am getting the error - syntax error converting datetime to character string - please help!
my code -
onload - dtpicker1.value = date
(tblcontacts.dtmrecontactdate is date/time)
Set adoduecallbacks = New Recordset
adoduecallbacks.Open "Select * from tblcontacts where dtmrecontactdate = ' " & DTPicker1.Value & "%" & " ' ", db, adOpenStatic, adLockOptimistic
- Please help!!!
Thanks
Problem With SQL Date Query (Todays Date)
Hi there,
Having a problem getting an SQL query to work when searching a database for todays date (basically a reminder package).
Here's the query
Set MyRecSet = MyConn.Execute("SELECT CoxRef, CompanyName, ContactName, postcode, tel FROM Reminders WHERE ReminderDate = #(date)# ")
Have tried all sorts of different things such as '&(date)&'") etc.
Only works when I type the date in like so .. WHERE ReminderDate = 15/02/2005
Any ideas please ?
Seymour
Compair Todays Date To A Date On File
Code:
Public Sub CheckExpire()
sb.Panels(1).Text = "Checking For Expired Membership!"
Dim B
Dim A
B = 1
A = 1
Do
If sb.Panels(2).Text = list.TextMatrix(B, 5) Or sb.Panels(2).Text > list.TextMatrix(B, 5) Then
If list.TextMatrix(B, 1) = "" Then
Exit Do
Else
Form2.Show
Form2.list.TextMatrix(A, 1) = list.TextMatrix(B, 1)
Form2.list.TextMatrix(A, 2) = list.TextMatrix(B, 2)
Form2.list.TextMatrix(A, 3) = list.TextMatrix(B, 3)
Form2.list.TextMatrix(A, 4) = list.TextMatrix(B, 4)
Form2.list.TextMatrix(A, 5) = list.TextMatrix(B, 5)
Form2.list.TextMatrix(A, 6) = list.TextMatrix(B, 6)
B = B + 1
A= A + 1
End If
Else
B = B + 1
End If
Loop
A = A - 1
sb.Panels(1).Text = "Check Complete, " & A & " Found To Be Expired!"
End Sub
Humm? 0 Found, I Added 1 With A Expired Date, Ideas?
Edited by - catacomb on 8/29/2003 11:00:16 AM
Its Like It Doesnt Exist!!!
So here i am made this tiny little program for an assignment thast due tomorrow.. and i tried to run it, and poof it wont run... im not saying theres an error (which their might be) but it wont run AT ALL.. i click the little play button and it brings up the macro tools, and asks me which macro i want to run... (normally itll run it automatically).. heres what i have..
Code:
Sub Ngrade(ByVal MT As Integer, ByVal FE As Integer)
Dim midterm As Integer
Dim final As Integer
Dim numgr As Integer
Dim row As Integer
Worksheets("Grades").Activate
row = 2
Do Until (IsEmpty(Cells(row, 9)))
MT = Cells(row, 8)
FE = Cells(row, 9)
midterm = (MT / 90) * 100
final = (FE / 100) * 100
numgr = (0.75 * final) + (0.25 * midterm)
Cells(row, 10) = Application.RoundUp(numgr, 0)
row = row + 1
Loop
End Sub
and it wont play at all... is it the macro, or soemthing to do with excel...
Go To Todays Date Row
Hi-
I was wondering if anyone could help me write a macro that when clicked on would take the user to todays date.
My spreadsheet is set up with every date from now until 2010 on the left column.
I want a feature where you click on a button an it takes you to (maybe even highlights that row) the current date.
Any help would be appreciated. I have never used VB or macros before.
thx
matt
Todays Date
is there a way to have a caption display todays date?
If File Doesnt Exist
when loading a file. say the file the person wants to load doesnt exist how do you make it
Code:
msgbox "there is no file by that name"
only if it doesnt exist
If Doesnt Exist Then Create
Is there a way I could make 2 arrays, One has Usernames(Var Userlist), The Second one has scores(Var Scorelist). Have it so if current username(Var Usern) doesnt exist in any array strings in array Userlist then create another string in array Userlist and have the new string's contents be Username and also know what spot in the array it is located and save the number for location in the array as Var userloc. if it does exist have it save the number for location of the name in the array as userloc.
Thanks
How Do I Insert Todays Date Using Sql
I have an access table and I want to insert today's date into one of the field. What is the correct syntax.
This is not working:
Dim todaysdate as String
todaysdate = format(Now,"m/d/yy")
Insert into table(Date)Values(todaysdate)
Thanks
Table Or View Doesnt Exist
I am new to VB/ADO and oracle, and really need help. I am trying to get information from an oracle view and the error message says "ORA-00942 table or view does not exist." The view exists in the database, in SQL-PLUS data will appear, and a DESC will show all fields. What is wrong with this code or is something missing? Any reply is really appreciated. Thanks.
Private Sub Command1_Click()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
With cn
.Provider = "OraOLEDB.oracle"
.ConnectionString = "data Source = vmprod;user id=name;password=passwd;"
.Open
End With
cmd.ActiveConnection = cn
cmd.CommandText = "select sorderid from view_sum_ordrqty"
cmd.CommandType = adCmdText
Set rs = cmd.Execute
While Not rs.EOF
MsgBox rs!sorderid
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
**RESOLVED!!** Deleting Name From D/b That Doesnt Exist?
I have this form where if I type a persons name in I want to be able to press enter and if that name exists on the database recall all the info I have put in for them in the past.
I have the screen below already working to record data you put in but cant figure out how to get it to see info previously added..
Of course I will have a Check or Enter button.. but if someone can get it to auto seek then all the mroe better
This is the code I think I need to base it around... (hopefully)
Code:
Private Sub cmdEnter_Click()
gblA = DbOpen(db, ws)
sql = "SELECT * FROM [CoachingNotes] WHERE [Name] = " & """" & txtName.Text & """" & "
Set rs = db.OpenRecordset(sql, dbOpenDynaset)
rs.MoveFirst
Do While Not rs.EOF
txtName.text.AddItem rs!Name
txtprevious.text.additem rs!Notes
rs.MoveNext
Loop
End Sub
--------------------------------------------------------------------------------
I am a VB learner with huge ideas!! push yourself and you shall learn more
First Project: www.BowlAGE.co.uk (Forever GROWING!!)
I aim to assist the Ten Pin Bowling Instructors around the world with this!!!!
--------------------------------------------------------------------------------
Edited by - EPOS on 12/17/2004 3:06:33 AM
Application.run - Macro Doesnt Exist
Hi guys
I created a sub which opens new sheet and add code in it.
after that i run the macros inside the sheet and i get error which tells me the macro doesnt exist.
I also have application.run I added in the new macro I added.
If i close the form and open it again after the code was added it's works,
but if i want to run the macro after creating the code, it doesnt work.
anyone have idea???
Example of the code:
Private Sub AddWorksheetEvent(ByVal SheetName As String)
Dim VBCodeMod As CodeModule
Dim LineNum As Long
Set VBCodeMod = ThisWorkbook.VBProject.VBComponents(SheetName).CodeModule
With VBCodeMod
LineNum = .CountOfLines + 1
.InsertLines LineNum, _
"refresh() & _
application.run "a" b c d ...."
end with
application.run "sheet1.refresh"
end sub
Copy W/ Archive Tag
hi,
how can i copy a folder, however only copy it if the archive tag is set? and then once it is copied, it removes the archive tag?
ta
(please dont tell me to use xcopy!!)
List ALL Files For Todays Date
Hi,
Can someone please help me with the following request.
I wish to list all file names on my hard disk that have a last accessed/modified date of today - this includes all subdirectories
from the root directory.
Thanking you in advance.
Cheers,
Kevin
Saving Textbox With Todays Date
I am trying to save the text in a textbox with the with the current date automatically updated every day by simply clicking a button
This is what I have but it doesnt work
visual basic code:--------------------------------------------------------------------------------Public Function SaveText(Text1 As TextBox) As Boolean
Dim hFile As Integer
Dim sFileName As String
On Error Resume Next
hFile = FreeFile
sFileName = App.Path & "C:" & Format(Now, "yyyymmdd") & ".txt"
Open sFileName For Output As #hFile
Print #hFile, Text1.Text
Close #hFile
End Function
Private Sub Command1_Click()
Call SaveText(Text1)
End Sub
Private Sub Text1_Change()
End Sub
--------------------------------------------------------------------------------
Adding Days To Todays Date
I want to add x amount of days to todays date. The number of days is held in an integer variable...how would i do it????
Inserting Todays Date With Button
I am v new to this VBA lark so be kind :-)
I have three cbo's - dd, mm, yyyy and what I want is a button next to the date dropdowns so you can click 'today' and it fills out the dd/mm/yyyy with todays dates.
I currently have this cbo code :-
With cbodd
.AddItem "01"
.............
.AddItem "31"
End With
With cbomm
.AddItem "January"
.............
.AddItem "December"
End With
With cboyyyy
.AddItem "2004"
.............
.AddItem "2008"
End With
Any help/pointers very welcome!
Thanks
Pete
Edited by - petebrooker on 6/22/2004 10:10:00 AM
Saving Text With Todays Date
I am trying to save the text in a text box as for example "20050511.txt" for todays date. I want the date to update automatically and I want the file to save when I click a command button.
Please help if you can
Control Array Element Doesnt Exist
Quote:
Run-time error '340':
Control array element '2' doesnt exist.
When I bring up the form to add the controls, I put in the number 1. the controls are on the form but are hidden, the index of these controls is set to zero. Can send a video of my steps if you like.
This is whats highlighted in my code... please advise....
VB Code:
Private Sub cmdOK_Click() 'numbers can only be inputted into the text field 'NumbersOnly is a Public Sub inside modTextBoxValidation NumbersOnly txtNumber 'now add the amount of picture boxes m_Images = Abs(txtNumber.Text) With frmMain For m_intAmount = 1 To m_Images Set objUserControl = .Controls.Add("VB.PictureBox", "picImage" & m_intAmount) 'make sure that when the object is added, it does not go outside the picWorkArea area 'picWorkArea is then the objects "container" Set objUserControl.Container = .picWorkArea Next 'now make the control visible to the end user [hl].picImage(m_intAmount).Visible = True[/hl] End With 'now close me Unload MeEnd Sub
What If A Registry Key Doesnt Exist - Error Handling - PLEASE HELP.
Hi All,
My little program to read in IP Address from registry is not working.
On Error GoTo IP2
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans 000IPAddress")
IP2:
On Error GoTo IP3
If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans 001IPAddress")
End If
IP3:
On Error GoTo IP4
If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans 002IPAddress")
End If
IP4:
On Error GoTo IP5
If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans 003IPAddress", "0")
End If
IP5:
These error handles dont work. Basically what I want is if ("HKLMSystemCurrentControlSetServicesClassNetTrans 000IPAddress") doesnt exist then try ("HKLMSystemCurrentControlSetServicesClassNetTrans 001IPAddress") and so on, but dont output an error.
Any ideas anybody?.
Reading Todays Date / Display Data
I'm writing a small address program and wish that it will display a list of birthdays/anniversaries that are happening 'today' when the form loads.
As I have the control version of VB I am unable to read from a database, so I thought that I would just list them - but can I get VB to read a list and recognise 'todays' date?
A direct to research would be helpful, Cheers
FIXED!!! Display Todays Date <Access>
< edit > I got it working...
How do assign today's date to a text box? I tried searching around here before posting a simple question.
Here is what I have:
Code:
Private Sub order_date_BeforeUpdate(Cancel As Integer)
order_date.Value = Date
End Sub
Edited by - SubPar_Coder on 9/15/2004 3:00:46 PM
Error - Shared Memory Sql Server Doesnt Exist ............
Hi evryone
I have installed SQL server mixmode authorization.
After installing when i try to connect to database using sa account.
it gives error like Microsoft ODBC sql server driver - shared memory- sql server doesnt exist or access denied.
I unistalled sql server and again i installed. but same error facing.
Please reply.
Regards,
Monthview DayBold Works, But Resets To Todays Date.
This is a pretty easy task I think, but I wanted to run this by everyone on the forum.
My program revolves around a monthview control. The user clicks the date they want to work with and off they go. What I'd like to do is have the monthview control show the days in bold where data has been entered into the database. That way the user can see at a glance (one month at a time) where they've entered data.
I think the easiest way to do this is to find the first and last day of the month their working in then run a query that selects distinct dates from the database where they fall in between the first and last days of the month. At that point I can loop through and say if there is a match, bold the day...if not, move to the next day.
So I guess all I need is how to find the first and last days of a month based on where the user is currently sitting in the monthview control.
Program Crashes If Directory Doesnt Exist On Host Computer
ok question i have is this:
i have a program that checks a certain directory that can be set manually by the person useinga browse button...ok this works fine....
what i wanted to do was to make the program when it started to have a path already set in the text box to start....just to be user friendly....ok i got this to work fine also.....
where i ran into a problem was when i had someone beta test it for me when they went to hit the browse button it came up with a error saying path not found and it closed the whole program...we found out what it was was the main path i have set as default...becouse he doesnt have that path originally...so he created it himself and the program worked fine.....
what i want to know is is there a way that i can still have my program start with this default path but if they dont have it keep my program from showing a path error and letting them use the browse button to selct there own.....
im thinking its gonna be a error command but im not sure or if i have to use a "check to see if path exist on form load"
so any help on this thanks in advanced
Q.1 - Adding Todays Date To The Write File When Saving And Q.2 - Appending
I would like to know if I could add a statement to the write command somewhere in the following code, so the file would write Todays date at the end in date format MM/DD/YY:
As the text in my write file looks like this:
"Flower - Lilac",2,5.22,10.44
Could I get it to add TODAYS date automatically to read
"Flower - Lilac",2,5.22,10.44,03/07/04
My code now reads:
**************************************************
Private Sub cmdWriteQuotation_Click()
Dim pintCurrentItem As Integer
Dim pstrFileName As String
Dim psngTotal As Single
pstrFileName = _
InputBox("Enter the filename", "Write File")
If pstrFileName <> vbNullString Then
Open pstrFileName For Output As #1
For pintCurrentItem = 0 To _
lstQuotedExtPrice.ListCount - 1
Write #1, _
lstQuotedProduct.List(pintCurrentItem), _
Val(lstQuotedQty.List(pintCurrentItem)), _
Val(lstQuotedPrice.List(pintCurrentItem)), _
Val(lstQuotedExtPrice.List(pintCurrentItem))
Next
psngTotal = 0
For pintCurrentItem = 0 To _
lstQuotedExtPrice.ListCount - 1
psngTotal = psngTotal + _
lstQuotedExtPrice.List(pintCurrentItem) * 1.06
' Above line computes Sales Tax directly into total
Next
txtTotal.Caption = Format(psngTotal, "Currency")
End If
Close #1
End Sub
****************************************************
Also, when I pull this data into an Access Table it leaves the .44 off the total price of 10.44 as from the line below: why?
"Flower - Lilac",2,5.22,10.44 (It pulls the 5.22 just fine, but the 10.44 it gives me 10)
Also someone told me how to append the write file here earlier by using the Append command with the For statement, but can't get that to work...could someone give me a clue how to change this Statement to append all new input to the same text file.
My existing code is above and if you can show me how to use the append command I'd sure appreciate this too...
Thank you
NMP
Newbie Help: Copy/rename .mdb And Move To Archive Directory
I have a process automation program. As it records alarms in the system it stores them in an access db. The file tends to grow and there has never been any consideration for file size and performance. I'd like to write a routine that would copy the mdb to a new directory, rename it and then flush the data from the table of the original...
There is a scheduler built into the system and I can call the routine from the scheduler once per month. Can someone help me with code suggestions?
Tim
Simple Copy Macro Doesnt Work
I need a simple macro that looks at a cell and copies the value into the cell below, as long as it is empty. If the cell has a value, it moves on, and looks for the next empty cell, again copy the value from the cell above.
Here is what I have:
Code:
for z = 1 to 15567
If cells(z,1)>0 then
InsertText = Cells(z, 1).Value
Range(z, 1).Select
Selection.Copy
next z
this doesnt work. any suggestions?
Wondering It Doesnt Support File Copy
Im wondering it doesnt support a filecopy while my application is busy all the time ?
VB Code:
Private Sub MonitorCommand_Click() Dim Dummy As Long Dim Changes As String Dim WaitNum As Long Dim I As Integer Dim Fl As String Dim Fm As String If UCase(MonitorCommand.Caption) = "START MONITORING" Then For I = 0 To 4 Next SelectFolderCommand.Visible = False MinutesCounter.Enabled = False Check1.Enabled = False Timer1.Enabled = False BlueProgressBar.Visible = True Interval = MinutesCounter.Value * 1 BlueProgressBar.Max = Interval Timer.Enabled = True MonitorCommand.Caption = "Stop Monitoring" WSubFolder = IncludeSubDirCheck.Value WatchStart = True 'Get Folder Handle FolderPath = FolderToMonitorText.Text If right(FolderPath, 1) <> "" Then FolderPath = FolderPath + "" DirHndl = GetDirHndl(FolderPath) If (DirHndl = 0) Or (DirHndl = -1) Then MsgBox "Cannot create handle": Exit Sub 'Create thread to Watch changes Do ThreadHandle = CreateThread(ByVal 0&, ByVal 0&, AddressOf Star****ch, DirHndl, 0, Dummy) Do WaitNum = WaitForSingleObject(ThreadHandle, 50) DoEvents Loop Until (WaitNum = 0) Or (WatchStart = False) Changes = "" If WaitNum = 0 Then Changes = GetChanges If Changes <> "" Then List1.AddItem Changes If left(Changes, 11) = "Added file-" Then Fl = Mid(Changes, 12, Len(Changes) - 11) Fm = UCase(right(Fl, 3)) End If If Timer.Enabled = False Then SendToBlue Changes End If Loop Until Not WatchStart 'Terminate the Thread & Clear Handle If DirHndl <> 0 Then ClearHndl DirHndl If ThreadHandle <> 0 Then Call TerminateThread(ThreadHandle, ByVal 0&): ThreadHandle = 0 Else Timer.Enabled = False WatchStart = False MonitorCommand.Caption = "Start Monitoring" For I = 0 To 4 Next SelectFolderCommand.Visible = True MinutesCounter.Enabled = True Check1.Enabled = True Timer1.Enabled = True BlueProgressBar.Visible = False End IfEnd Sub
Filecopy - Doesnt Copy The File (Resolved)
i'm using the filesystemobject. this is my code:
Dim fs As FileSystemObject
Dim filetocopy as string
dim newfile as string
cdSave.FileName = "main_orange.mdb"
cdSave.ShowSave
Set fs = CreateObject("scripting.filesystemobject")
newfile = cdSave.FileName
filetocopy = "C:orangemain_orange.mdb"
fs.CopyFile filetocopy, newfile
I also tried using the FileCopy(source,dest), still it doen't copy the file.
what's wrong with my code?
Button Save Doesnt Work, We Are Using Mysql For Our Database
This is our code for the save button:
Private Sub btnsaveD_Click()
btnDeleteD.Enabled = True
btnsaveD.Enabled = False
btncancelD.Enabled = True
btnaddD.Enabled = True
initDB
With rec
.Open "SELECT reimbursement.docnum,reimbursement.desc,reimbursement.srcRm FROM reimbursement", doccon, adOpenKeyset, adLockOptimistic
.AddNew
!docnum = txtbarcodeRm.Text
!Desc = txtdescRm.Text
!srcRm = txtsource.Text
.Update
.Close
End With
MsgBox "ok"
End Sub
The problem with this code is that during we click the save button it will generate error : on !srcRm = txtsource.Text, the value assigned in the txtsource.text was not passed on !scrRm field, the value still null, I dont know how to trace this error. Do you have any idea about this kind of problem?
Date Report Doesnt Refresh
im using the code given below to generate report, sql query is generated on runtime which saves in string StrSQL...
but the problem is that it generate report for the time and after that during entire application life it will display the same report even though the sql statements are changed, in short active report isnt refreshing???? ne one has the solution?
Code:
MsgBox "Click ok to load", vbOKOnly
DataEnvironment1.Commands("Command3").CommandText = strSQL
'MsgBox strSQL
DataReport2.Show
Unload Me
thnx in advance
Date In Functions Doesnt Work All The Time
I have created a function to calculate the maximum value from a grouping in an access report that is dependant on certain criteria. the function has 2 variables passed to it from the relevant group on the report - date and code. the report works as planned until it reaches a particular date 1/6/01 then it returns 0 as the recordset count wheras there are definitely records in the query. If i specify the date within the function as #1/6/01# it returns records but using a variable (defined as a date) it returns 0 on this particular date. I have attached my function as a text file - Any help would be marvellous - thank you very much
Copy To 3rd Level Subfolder When Dest 2nd Level Folder Doesn't Exist
I have 2 folderpaths:
C:Sourcelib
C:Dest\%todaysdate% estlib
I want to copy the lib folder from the first path to the second path. Currently I use vb to replace %todaysdate% with a real date of course, but when it comes time to copy with the Nucopy or the SHFileOperation commands, they both error out because that 'date' folder and the 'test' folder inside the destination path hasn't been created yet.
DOS' xcopy will create the entire path of folders no matter how many deep they are, even if they don't exist.. I've not yet found a proper match for xcopy in vb. Are there any premade APIs out there that can copy to multiple levels of subfolder and auto create the path it needs without having to split apart the path to create each level one by one? or perhaps someone has some optimized code to do this somewhere?
Save Date Of Key-in Data Using Date()
how to make date that data key-in to still reamin at that date?
i mean if i add new data yesterday, field hold yesterday's date. and when i add new date today, last date that i add data still yesterday date..... using Date()... need to put '#' ? like this #date()#?
sorry ..not good in english
Trapping For/in SQL Update To Determine Exist Or Not Exist Record
All,
Problem: I'm using a SQL Update command to update a username and password database (Access.) Update works on existing records and updates correctly. The problem is that the Update statement doesn't error out when the username doesn't exist. Basically, it doesn't do anything and doesn't give an indication that it failed to find the username specified.
Desired result : If username doesn't exist, I need to trap for that when performing the SQL Update procedure and let the user know that the password to be updated for that particular user is invalid since the username doesn't exist in the database.. Por ejemplo:...
.
Code:
Private Sub cmdUpdate_Click()
Dim PasswordConn As ADODB.Connection
Dim PasswordRecSet As ADODB.Recordset
Dim strUpdateuser As String
Dim strUpdatepass As String
Dim strUpdatenotes As String
Set PasswordConn = New ADODB.Connection
PasswordConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:programmingLBPP Password Utilitypasswordutility.mdb;"
PasswordConn.Open
strUpdateuser = txtUsername.Text
strUpdatepass = txtPassword.Text
strUpdatenotes = txtNotesPassword.Text
Dim SQL As String
SQL = "Update PasswordUtility SET fldPassword = '" & strUpdatepass & "', fldNotesPassword = '" & strUpdatenotes & "' WHERE fldName = '" & strUpdateuser & "';"
PasswordConn.Execute SQL
'If user name doesn't exist than tell the fool!!
PasswordConn.Close
End Sub
Save Copy As
I'm trying to save a copy of an Excel spreadsheet at the turn of the new year. I have been using datediff to determine the new year. How can I attach the date value to the new excel name ?
e.g.
tumble2005.xls
'CDate(cells(n,5).value is the year I need attached.
This not working:
ActiveWorkbook.SaveCopyAs "\aaaxxxsef"(Tumble & CDate(Cells(n, 5).Value)"
Save Copy Of Bitmap
I'm trying to open a bitmap file in binary mode and then open
a temp binary file to copy the contents of the first file into the
second file. The second file will also contain a string that i want
to place in it after all the other data has been added to it. I guess
what i need to know is can i just straight copy all the data from the
first file and place it in the second file and still expect it to be a bitmap?
When i do it i get nothing but a blank bitmap. Here's my code:
Code:
' Declares
Option Explicit
Private Type BITMAPINFOHEADER '40 bytes
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type BITMAPFILEHEADER
bfType As Integer
bfSize As Long
bfReserved1 As Integer
bfReserved2 As Integer
bfOhFileBits As Long
End Type
Dim FileHeader As BITMAPFILEHEADER
Dim InfoHeader As BITMAPINFOHEADER
Dim OrgFile As String
Dim TempFile As String
Dim TempString As String
Code:
Private Sub Form_Load()
' Path to the orginal bitmap and a temp bitmap
' and a test string
OrgFile = App.Path & "USflag.bmp"
TempFile = App.Path & "Temp.bmp"
TempString = "This is a test string"
End Sub
Private Sub cmdLoad_Click()
' I open the first bitmap to get
' the FileHeader and InfoHeader data
Open OrgFile For Binary As #1
'read the file headers
Get #1, , FileHeader
Get #1, , InfoHeader
Close #1
' I assume i can just copy all that data
' from the first bitmap into the temporary bitmap
' and add the test string at the end.
Open TempFile For Binary As #2
Put #2, , FileHeader
Put #2, , InfoHeader
Put #2, , TempString
Close #2
Oviously i'm doing something wrong since it does work.
Anyone got the correct way to do this?
End Sub
Use Vba To Save Copy Of Wrksht As .csv???
ok.
i have some vba code that is in a file called "test.xls".
when i open the file it queries a database and populates the sheet.
i then have code that saves the workbook as "test_date.xls"
my problem is that i do not want the copy of the spreadsheet to include the vba code... just the data?
is this possible?
thanks as always for the help.
Excel --- Save A Copy As Xml
I need to save a ***copy*** of the current workbook as xml:
Now you would think it would be something like:
ActiveWorkbook.SaveCopyAs Filename:= _
"C:FIN.xml", FileFormat:= _
xlXMLSpreadsheet, ReadOnlyRecommended:=False, CreateBackup:=False
However, it gets stuck on "FileFormat". ANY IDEAS?
If you change "ActiveWorkbook.SaveCopyAs" to "ActiveWorkbook.SaveAs" it works however it does not make a *copy* but instead changes the current workbook to xml.
|