Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




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




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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...

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

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

Listview.ListCount Property Doesnt Exist?
Hi i have been trying If jobsectionlist.ListCount > 0 Then
but it doesnt work

i really need a quick way to check if the listview is empty or not

anyone know how?

The Frame Control Is Acting As If It Doesnt Exist
i have loaded the form which might explain

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("HKLMSystemCurrentControlSetServicesClassNetTrans000IPAddress")
IP2:
On Error GoTo IP3

If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans001IPAddress")
End If
IP3:
On Error GoTo IP4

If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans002IPAddress")
End If
IP4:
On Error GoTo IP5

If Trim(IP) = "" Then
IP = WshShell.regread("HKLMSystemCurrentControlSetServicesClassNetTrans003IPAddress", "0")
End If
IP5:

These error handles dont work. Basically what I want is if ("HKLMSystemCurrentControlSetServicesClassNetTrans000IPAddress") doesnt exist then try ("HKLMSystemCurrentControlSetServicesClassNetTrans001IPAddress") and so on, but dont output an error.
Any ideas anybody?.

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,

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

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?

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?

PaintPicture Doesnt Seem To Work In My Form_Load Macro
Bizzarre:

This code is in a filelist box that displays available images.


Code:
Private Sub flbPhotos_Click()
Dim PicPath As String
PicPath = frmSELECTPICPATH.DirPhotos + "" + frmSELECTPICPATH.flbPhotos
frmSELECTPICPATH.picboxEmployee.Picture = LoadPicture(PicPath)
picboxEmployee.PaintPicture frmSELECTPICPATH.picboxEmployee.Picture, 0, 0, frmSELECTPICPATH.picboxEmployee.Width, frmSELECTPICPATH.picboxEmployee.Height
End Sub


This code is in the Form_Load routine

Code:
Private Sub Form_Load()
Dim i As Integer
Dim SavedPicPath As String
Dim PhotoSelected As String
Dim EmployeeName As String
On Error GoTo MyTrap:
EmployeeName = frmMANAGE_EMPLOYEE.txtFirstName + frmMANAGE_EMPLOYEE.txtLastName

frmSELECTPICPATH.Left = GetSetting(appname:="SSS", Section:="PathSettings" + CurrentUserStr, Key:="frmSELECTPICPATH_MyLeft", Default:=0)
frmSELECTPICPATH.Top = GetSetting(appname:="SSS", Section:="PathSettings" + CurrentUserStr, Key:="frmSELECTPICPATH_MyTop", Default:=0)
frmSELECTPICPATH.DirPhotos = GetSetting(appname:="SSS", Section:="PathSettings" + EmployeeName, Key:="frmSELECTPICPATH_DirPhotos", Default:=frmSELECTPICPATH.DrivePhotos)
frmSELECTPICPATH.DrivePhotos = GetSetting(appname:="SSS", Section:="PathSettings" + EmployeeName, Key:="frmSELECTPICPATH_DrivePhotos", Default:="C:")
PhotoSelected = GetSetting(appname:="SSS", Section:="PathSettings" + EmployeeName, Key:="frmSELECTPICPATH_flbPhotos", Default:="")
If Not PhotoSelected = "" Then
For i = 0 To flbPhotos.ListCount
flbPhotos.Selected(i) = True
If PhotoSelected = flbPhotos Then
flbPhotos.Selected(i) = True
Exit For
End If
Next
End If

SavedPicPath = GetSetting(appname:="SSS", Section:="PathSettings" + EmployeeName, Key:="frmSELECTPICPATH_picboxEmployee", Default:="")
If Not SavedPicPath = "" Then
frmSELECTPICPATH.picboxEmployee.Picture = LoadPicture(SavedPicPath)
frmSELECTPICPATH.picboxEmployee.PaintPicture frmSELECTPICPATH.picboxEmployee.Picture, 0, 0, frmSELECTPICPATH.picboxEmployee.Width, frmSELECTPICPATH.picboxEmployee.Height
Else
frmSELECTPICPATH.picboxEmployee.Picture = LoadPicture(NoPic)
End If
MyTrap:
End Sub


Now why does my form load with the picture not formatted to fit my picturebox. But when I click the file in my filelist box the picture displays formatted to the picturebox.

Check If A Macro Exist
I want to make a function that check if a specific macro exist. I don't know how to get a list of usable macro by the template.

Run A Macro If A File Doesn't Exist...
Hi there!, is me again... you missed me?

This question its about open a File, I made a macro that opens a file, but I have a little problem, sometimes the file its in the folder, sometimes no, what I want its to open the file if its there or run a macro if there is no file, somebody knows how can I do this?, I think there could be an option in Open statement but I can't found it, also there could be an option in error statement (if error Number xxx occurs then run this macro) but I suck in error statements... plz somebody give a little candle in order to iluminate me

I think is somebody like this


Code:
Workbooks.Open Filename:=directory & "hi.xls"
if workbooks.open Error then
macro_nofile
Else
End if

thanks for advance

Distributing My Application, HELP! It Doesnt Work On Another PC
Hi,

Have developed an Application in Word 97 VBA using O/S Windows 98 on my PC.

I have attempted to distribute my application on other PC's, It works on all but 1, which has an O/S of Windows 98 and Word 97. On This PC everything works fine, except for the Common Dialog Box.

On my PC I have developed it using Common Dialog Box 6. I have noticed that the PC I am trying to get it working on only has Common Dialog Box 5 installed. I have tried to copy COMDLG32.ocx from my machine to the other, hoping that this would update the control, it didn't. Now when i try to add the control (I can add the control to the toolbox) i am displayed with the error: Library not Registered.

Can anybody help? Or is there a URL perhapes on microsoft where I can download or update common dialog 5 to version 6?

Thanks

Datareport Doesnt Allow My Vb Application To End Completely.
In my vb application there are few Datareports. After viewing few reports I end the application as a normail flow. But the program doesnt end up completely and reside there in the Applicaitons tab of Taskmanager. It seems an instance of the application not completely removed from the memory. Can anybody let me know what is the work around of it.

Thnx,
Bikash

If Application Exist
Hi. I've looked for this all over google and I can't find anything about it.

Is there a way to let my VB program to look for an external program which is running by looking at it's name in APPLICATIONS tab of CTRL+ALT+DELETE and/or in the taskbar of windows?

All I can find is how to see if a program exists in PROCESS list but thats not what I want.

Hope you guys can help.

How To Make A Inputbox That Doesnt 'pause' The Application?
So I can load multiple inputboxes at once?
And the inputbox cant hold up the main application..
Is there a way to do this?
How can I make such an inputbox and fire an event telling me when input has been entered?

Does Application.IgnoreRemoteRequests Exist?
Hi guys, please excuse the complete Word Newbie here...

In Excel there is a command that allows one Automating/Controlling Excel to prevent the User from "hijacking" your Excel instance. The command is
Code:
Application.IgnoreRemoteRequests = True
Without this, if the User double-clicked on an Excel Workbook icon, your instance of Excel would Unhide and now be under the user's control -- but if Application.IgnoreRemoteRequests is set = True, then double-clicking a Workbook icon would create a new instance of Excel for the User, leaving the Programmatic instance untouched.

Related to this is that in Excel, Application.UserControl is Read/Write whereas in Word it appears to be Read-Only? Does this, then, imply that *effectively* that when Word is opened Programmatically, then "IgnoreRemoteRequests" is automatically set = True, and is immutable (as is the UserControl property)?

Thanks all, in advance ,
Mike

How To Make Code Multi-tasking So It Doesnt Halt My Application???
I have an application that frequently gets the html source code from a web page from the internet but whilst it is getting the page the application doesnt allow you to do anything else - it is frozen until the web page is retrieved.

I want to be able to retrieve a web page in the background and have the application fully functional at all times.

I use an alternative to the Internet Transfer Control (GetHTMLFromURL) to get the web page source code. It also happens when I use the Microsoft internet transfer control.

I tried putting the code to retrieve the web page into an Active X control, Active X DLL and an Active X EXE file but the applicatrion still freezes when the web page is being accessed regardless.

Can anyone help me with suggestions on how I can retrieve a web page html source code without slowing my application?

Thank you.

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

Macro Application Path
Guys,

I have a macro that i embedded on the MS word application. All the supporting files for the macro are pushed into c:/documents and settings/dng/.../startup on all users machines in the company...

so now when i (as a user) open MS word and open a doc file that is on my c drive and try to run the macro...WHAT SHOULD BE THE APPLICATION PATH THAT I SHOULD PUT IN THE CODE SO THAT IT REFERS TO THE c:/...../startup folder because my supporting files are there...

i tried

1.App.path("mypathhere")
2. Application.Startuppath("mypathhere")

and i tried lot of other variations...but nothing worked...

any suggestions...

-DNG

Use Macro Variables Value In Vb.net Application
Project Description:-

> We are developing one real time application which transfer real stocks data from one server(s1) to another

server(s2).

> There is one excel file on server(s1) which is continuously updated and we need to transfer those updated

data to server(s2) in every single seconds using tcp or udp connection.



-->For achiving this functionality we implement following method:

    Method :--
               - First create macro for getting address and value of updated cell in excel sheet.
                 
                 Macro Code ---
            ***

            Private Sub Worksheet_Change(ByVal Target As Range)
                Dim VRange As Range
                 Set VRange = Range("A1:P100") ' input range
      
       
                        Dim address As String
        
                        address = Intersect(Target, VRange).AddressLocal
        
                    '' Get updated cell value
                        Dim cellval As String
        
                        cellval = Intersect(Target, VRange).Value

            End Sub

            ***

        - We Create one vb.net window application for sending updated values from server(s1) to     

     server(s2) using udp.

I am facing problem that how can i get macro variables value in vb.net application so that those values are

transfered to server(s2).

If any one have any idea about this application or problem then help me.

Execute Macro In Word From Vb Application
I have a user that creates a document that I need to be automaticly processed when saved to a directory on the server (change some colors, fonts etc.. and save as html) . I want to be able to record a macro in the document (They always edit the same one and save a copy elsewhere) then open the document from vb and execute the macro I recorded previously.

Can this be done. It works now with sendkeys, but is messy at best. I think the macro would be much easier.

Call Word Macro From XAL Or Other Application
I need to call a word macro in a local document from the program Navision C5 (an XAL application). I think the way to do it is the same as calling from a command line.

Now i merge some data into a document created from a dot file. The merging interface is now a dll file wich I haven't coded myself, because I'm N00B

After the merge is done I have my merged document. Now I want to run a macro to process the merged infos. If I code a macro in the .dot file, the macro will run before the merge is done.

So I need a way to call a macro from the application i merge from, wich knows when the merge is done.
Or to make a macro that will run after the mailmerge. Either solution will be fine.

VB Application To Load A Word Macro
I have created a macro that needs to be installed on a large number of computers. Is there a way I can create a simple VB application to install the macro for me. The idea is to put everything on a shared drive,allow the user to download the VB app, open the app and click run. Then, the macro would automatically be loaded.

There may be a much easier way to do this and any ideas are appreciated.

Please help!!!

Edit Word Macro From VB Application..
I have to make a program in VB6 that ads a line to an existing macro of some word file. All files have the same macro. Dose anybody know how to do this??

Pastespecial Macro Crashing Application
Hello

I produced a macro that inserted a lookup into a column, then filled down the column. It then copied the lookup and paste speacialed the values, so as to remove the formula.

It worked fine, until now, where it just crashes Excel. The only change I made was to remove the sub routine from one module into a new one. I am completley stumped and don't know why its not working anymore

Any help on this matter would be most appriciated.

Cheers

James

Application For Create Macro In Word
i have created a macro in word. and want to use that macro in other machines.
so is it possible to create a application in vb for adding macro to other machines.

PDF A Word Document - Cross Application Macro
I am keen to write a macro that will PDF a word document - I am using Adobe Acrobat Version 5. In Word when recording macros it recognises that I want to PDF but from there on it does not record - - - i.e. I cannot choose to save the PDF to a folder and I want this option - - - it may seem like a pointless macro but the macro would not end here (hopefully)

....I would then want the macro to go back to the Word document, change it a little bit, and then PDF it again, and save it.

So my question relates to using Adobe Acrobat within the Macro...how do I get to do this? I am sure it is possible and am prepared to take some time getting it right,

internationally

Application With Record/Play Macro Feature
Hi there !
i am making a webpage editor and i was thinking of adding
a record/play macro feature to the program.
i mean that when i press record macro it start recording all my actions. when i press play macro it executes all commands that i made during my macro.

Have you any thoughts on how to do this ?
Should i give an id to each possible command of my application
and then print it on a text file along with the input for each command?

When i press play it will read the text file and then execute
all commands based on the id's i have written above.

Is there a more smarter approach possible ?

thanks !

Application With Record/Play Macro Feature
Hi there !
i am making a webpage editor and i was thinking of adding
a record/play macro feature to the program.
i mean that when i press record macro it start recording all my actions. when i press play macro it executes all commands that i made during my macro.

Have you any thoughts on how to do this ?
Should i give an id to each possible command of my application
and then print it on a text file along with the input for each command?

When i press play it will read the text file and then execute
all commands based on the id's i have written above.

Is there a more smarter approach possible ?

thanks !

Running Excel Macro From Visual C++ Application
I have a Visual C++ application from where i want
to start an excel macro.

The excel macro will be one i would have recorded using
excel.

Is their any sample code or reference where i can look up
how to do this ?

Any assistance in solving my problem would be appreciated.

Regards,

Riaz Awan

Application With Record/Play Macro Feature
Hi there !
i am making a webpage editor and i was thinking of adding
a record/play macro feature to the program.
i mean that when i press record macro it start recording all my actions. when i press play macro it executes all commands that i made during my macro.

Have you any thoughts on how to do this ?
Should i give an id to each possible command of my application
and then print it on a text file along with the input for each command?

When i press play it will read the text file and then execute
all commands based on the id's i have written above.

Is there a more smarter approach possible ?

thanks !

SQL Query For Exist And Not Exist Data
Hello all,

I have a set a data, now i need to search through a database to check whther it is exist in that database or not, any syggestion?
Example:

Now i have data 123, 234, 345. Let say data 123 and 234 is exist in that database, but data 345 is not exist in that database.

What SQL am i suitable to use to get those result exist(123, 234) and those result not exist (345)?

The database structure is someting like this:
ID NAME O_NAME
-- ----- --------
1 120 123
2 234 234
3 345 345

1) The data consider 'exist' if it exist in column NAME or column O_NAME (either one).

2) The data consider 'not exist' if it not exist in neither NAME column nor O_NAME column

After the SQL query, someting is expected:

Exist:

ID NAME O_NAME
-- ----- --------
1 120 123
2 234 234

Not Exist:

ID NAME O_NAME
-- ----- --------
3 345 345

I'll appreciate if anyone can provide me a solution..Thanks!

Word Macro Insert File/ Append Table Macro Issue.
Hello,

I was wondering if someone could help me with this problem...

When I use the following code to insert a table (from an external file), the table that is inserted does not append to the table in first document (which is what I want it to do)...

Sub Macro1()

Selection.Collapse Direction:=wdCollapseEnd
Selection.InsertFile FileName:="m:cat.DOC", Link:=True

End Sub

Would anyone know how I can make the contents of this file append to the table in the first document?

Thanks so much in advance,

Anne

Macro Opens A Document In Vba, Saves, Then Continue With Macro
Maybe the title isn't correct, but i've got the following problem.
I build a document that open a form. On this form there is a checkbox. When the checkbox is active and I press 'OK' a document has to be opened. On this document some changes can be made, then by pressing 'continue' this document is saved on 'c: emp' and closed. Then I want to go back to the first document and continue with it.
Is there some sort of halt or wait funtion to establish this?

The code I use is the following:

<code document1>
If chbFinPar = True Then
Documents.Open FileName:="f:Nieuwe format macroHuisstijlTestversiefinpar.doc"
Selection.EndKey , ActiveDocument.Bookmarks("bmkfinpar").Range
Selection.InsertFile FileName:="c: empfinpar.doc"
End If
<end code>

<code document2>
Private Sub cmdVrdr_Click()
ActiveDocument.SaveAs ("c: empfinpar.doc")
ActiveDocument.Close
End Sub
<end code>

Word Macro Editor Opens When I Misspell A Macro Name
I'm using Word 2000, and pressing Alt+F8 to access macros - just text strings - and here's the trouble:

I'm trying to make it possible for everyone here to use Word macros from the server. I've put a file out there called Macros.dot and it works great. Every machine in the building can see it and use it. Trouble is, if a user misspells a macro name the macro editor opens by default. It doesn't realize the user has misspelled something and thinks the user wants to write a new macro under the "new" name. User can click the X to close the editor, of course, but has now created a blank macro with a name very similar to a real macro. This will drive people (especially the less tech savvy) nuts, and clog up the file Macros.dot with garbage.

Is there a way to disable the macro editor from opening if an incorrect (nonexistent) macro name is typed? A check box somewhere, perhaps? I've tried but can't seem to find it, if it's there.

Thanks

Openning Excel And Running Macro From Word - Macro
Ok - I have a DB which I export to Excel, I then run a macro to "Groom The Data". I then run word and run a Macro (MailMerge to print labels) which retrieves data from the excel spreadsheet groomed above. Everything is working fine, despite my novice knowledge of VB, but I would like to do this in a single click.

I use a command line shortcut to Launch word and automatically have it run the macro, but I still have to Launch Excel and manually run its macro first.

I did not find a command line switch to make excel launch and run a macro. Is there any way I can Lauch Word have its Macro link to excel, then launch and run the excel macros before performing the macro I have set up in word (mailmerge)

In Other Words I have working macros in Word and Excel, I want the Word Macro to force the Excel macro to run before completing the rest of its duties.

Thanks
WW

How To Hide Macro Option From Tools Macro, Macros
Hi,
Well, this is the situation. I created some macros (6) for a workbook. One this macros is adding a new Menu in the main Excel Menu. The idea is that the user does not need to go to options: Tools, Macros, Macro...and run the macro because I want them to do it from the menu specially created.
Also I prevented any user to edit the macros putting password if they want to see the codes.
Now How I can prevent a user to run all my macros from the option:
Tools, Macros, Macro...Can I hide a Macro from that menu?

Any way to remove this option in just this workbook not affecting the user if they want to work with a new one...?
Or may be a message saying that macro can be run from the menu if the user is trying too.
Any suggestion?
Thanks!
Gonza

Can You Get An Access Macro To Include Running An XL Macro
Is it possible to have an MS access run its own "thing" and in the middle of it all call on excel to run it owns macro?

Word 200 Vba Macro Help - Enable Track Changes In A Macro. Thanks
I was able to find a macro which takes an already mail merged document, and saves each each document as a separate file. The document's filename is taken from the already merged document. The script works. It's in red. See below.

The problem is I need to enable the track changes option.I recorded the following macro. It's in blue.
With ActiveDocument
.TrackRevisions = True
.PrintRevisions = True
.ShowRevisions = True
End With
End Sub

I tried to incorporate this code(blue) into the code (red) below. I added it between ActiveDocument.Sections.First.Range.Cut and Documents.Add but it didn't work.

ActiveDocument.Sections.First.Range.Cut
ActiveDocument.TrackRevisions = True
ActiveDocument.PrintRevisions = True
ActiveDocument.ShowRevisions = True
Documents.Add

It turned on track changes but it didn't create each new document. What am I doing wrong?


Desperately Seeking help!!

Script works perfectly.
Sub SplitMergeLetter()
' splitter Macro
' Macro created 16-08-98 by Doug Robbins to save each letter created by a
' mailmerge as a separate file.
'
Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
Application.ScreenUpdating = False
Selection.HomeKey Unit:=wdStory
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
sName = Selection
'set path below
sPath = "C:MERGELETTERS"
Docname = sPath & sName
ActiveDocument.Sections.First.Range.Cut

Documents.Add
With Selection
.Paste
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
End With
ActiveDocument.SaveAs FileName:=Docname, _
FileFormat:=wdFormatDocument
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend
End Sub

Vb Doesnt Like '
okay. vb pulls data from excel and passes it to access table. all records transfer fine except "Ms. O'Connor." my guess is that access doesnt like " ' ".

The error im getting is "Syntax Error (missing operator) in query expression "O'CONNOR','3221 LITTLETON BRIDGE RD','AUSTIN','TX','73222','HH')'.

here is some code:
Private Sub subMenuOpen_Click()
Dim objXLApp As excel.Application
Dim objxlBook As excel.Workbook
Dim objxlSheet As excel.Worksheet
Dim maxRow As Integer
Dim maxColumn As Integer
Dim conn As ADODB.Connection
Dim statement As String
Dim newValue As String

Set objXLApp = CreateObject("Excel.Application")
objXLApp.Visible = True
Set objxlBook = objXLApp.Workbooks.Open("C:Documents and SettingsAdministratorDesktopTestMasterList.xls")
Set objxlSheet = objxlBook.Worksheets("sheet1")

'get the last used row and column
maxRow = objxlSheet.UsedRange.Rows.Count
maxCol = objxlSheet.UsedRange.Columns.Count

Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "D&M.mdb" & ";Persist Security Info=False"
conn.Open
' Loop through the Excel spreadsheet rows,
' skipping the first row which contains
' the column headers.
For Row = 2 To maxRow
' INSERT statement.
statement = "INSERT INTO MasterList VALUES ("
For Col = 1 To maxCol
If Col > 1 Then statement = statement & ","
newValue = Trim$(objxlSheet.Cells(Row, _
Col).Value)
If IsNumeric(newValue) Then
statement = statement & _
newValue
Else
statement = statement & _
"'" & _
newValue & _
"'"
End If
Next Col
statement = statement & ")"

' Execute the INSERT statement.
conn.Execute statement, , adCmdText
Next Row

' Close the database.
conn.Close
Set conn = Nothing



Thanks!!!

Why Doesnt It Run!
the error is 'INVALID QUALIFIER'!

A) what is one of these, and
B) wahts wrong witht his


Code:
Private Sub save_Click()
SaveSetting "JafferNet", "JafferChat", "nickname", username.Text
SaveSetting "JafferNet", "JafferChat", "server", server.Text
SaveSetting "JafferNet", "JafferChat", "email", email.Text
SaveSetting "JafferNet", "JafferChat", "name", name.Text
SaveSetting "JafferNet", "JafferChat", "age", age.Text
SaveSetting "JafferNet", "JafferChat", "gender", gender.Text
SaveSetting "JafferNet", "JafferChat", "desription", desription.Text
frmclient.Caption = "Welcome " & GetSetting("JafferNet", "JafferChat", "nickname") & ", to JafferChat"
Unload Me
End Sub

perfectly ok to me!

Call Macro ~change Macro
I want to create a print preview from a access rapport

I'm using this code:

Code:
Private Sub Command1_Click()
Dim A As Object

Set A = CreateObject("Access.Application")
A.Visible = true
A.OpenCurrentDatabase (App.Path & "
ewP2.mdb")
A.docmd.RunMacro "macroprinten"
ENd SUb
the first macrocommand is openreport + report name
at this instruction there is a posibility to specify a WHERE instruction.

Is it posible to chance this where instruction in visual basic
?


Many thx
grz
EBS

Run Access Macro From Excel Macro
Hi

I am using Microsoft Office 2000 and trying to run an Access macro from an Excel macro, but my Excel macro does not seem to be working. When I run the Excel macro, nothing happens - I do not get an error and the code does not do what it is suppossed to. Below is my code:

Code:
Sub DisplayForm()
' Initialize string to database path.
Const strConPathToSamples = "C:Miscell est.mdb"

strDB = strConPathToSamples & "test.mdb"
' Create new instance of Microsoft Access.
Set appAccess = _
CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strConPathToSamples
' Run Access macro.
appAccess.DoCmd.RunMacro "Macro1", 1
End Sub
I have included the references to "Microsoft DAO 3.6 Object Library" and "Microsoft Access 9.0 Object Library."
Any help on this subject would be much appreciated.
Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved