Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > macro / script wizzard required

macro / script wizzard required
Thread Tools
qnc
Mac Enthusiast
Join Date: May 2000
Location: London U.K.
Status: Offline
Reply With Quote
Jun 23, 2000, 02:00 PM
 
I have to do this boring copy paste job on my pismo.

These are the three programs I have written but they do not jump to the next line automatically and are not linked

How do l make it so that i only hit the return key and it does my work for me

Sub DoRows()

End Sub

Sub InsertRows3()
'
' InsertRows3 Macro
' Macro recorded 21/6/00 by Mol Gen
'
' Keyboard Shortcut: Option+Cmd+i
'
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert

End Sub
Sub CopyCells()
'
' CopyCells Macro
' Macro recorded 21/6/00 by Mol Gen
'
' Keyboard Shortcut: Option+Cmd+c
'
ActiveCell.Offset(-8, -3).Range("A1 11").Select
ActiveCell.Offset(2, 0).Range("A1").Activate
End Sub


Sub DoRows()

End Sub

Sub InsertRows3()
'
' InsertRows3 Macro
' Macro recorded 21/6/00 by Mol Gen
'
' Keyboard Shortcut: Option+Cmd+i
'
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert

End Sub
Sub CopyCells()
'
' CopyCells Macro
' Macro recorded 21/6/00 by Mol Gen
'
' Keyboard Shortcut: Option+Cmd+c
'
ActiveCell.Offset(-8, -3).Range("A1 11").Select
ActiveCell.Offset(2, 0).Range("A1").Activate
End Sub

Sub DoRows()

End Sub

Sub InsertRows3()
'
' InsertRows3 Macro
' Macro recorded 21/6/00 by Mol Gen
'
' Keyboard Shortcut: Option+Cmd+i
'
Selection.EntireRow.Insert
Selection.EntireRow.Insert
Selection.EntireRow.Insert

End Sub
Sub CopyCells()
'
' CopyCells Macro
' Macro recorded 21/6/00 by Mol Gen
'
' Keyboard Shortcut: Option+Cmd+c
'
ActiveCell.Offset(-8, -3).Range("A1 11").Select
ActiveCell.Offset(2, 0).Range("A1").Activate
End Sub
qnctv.com
Take a look...
     
MacCanada
Junior Member
Join Date: Oct 1999
Location: Edmonton, Alberta, Canada
Status: Offline
Reply With Quote
Jun 24, 2000, 11:25 AM
 
What language is that in? certianly<sp> not in AppleScript...



------------------
PGP key: http://www.geocities.com/maccanada/pgpkey.html
-30-
-- An idea is salvation by imagination.
-- Frank Lloyd Wright
-- 30 --
     
Paul Crawford
Dedicated MacNNer
Join Date: Nov 1999
Location: Georgetown, Demerara, Guyana
Status: Offline
Reply With Quote
Jun 24, 2000, 09:12 PM
 
Hi all,

The subroutines look like they were written in MS' cross-platform VBA language (or the VBScript subset), which is available within most MS Office apps, etc...

qnc, I'm a little confused about what you want to do. The three groups of subroutines that you posted all seem to be identical to each other, and I don't see any actual copy/paste commands such as 'Selection.Copy' & 'ActiveSheet.Paste' or direct assignment ['=']... Also, within each group, the "main" 'DoRows()' routine doesn't call either of the other two subroutines ['InsertRows3()' or 'CopyCells()']. I guess that you've been manually triggering the latter two subroutines via the indicated hot-keys. Do you want these subroutines to now be invoked from within 'DoRows()', and/or to use the Return key as a hot-key for 'DoRows()'? And, when you say "jump to the next line", do you mean you'd like to perform something other than an explicit 'ActiveCell.Offset(<n>, 0).Select' command after the cell-range is copied?

BTW, for general VBA tips (beyond MS Office's built-in Help), you could try exploring the resources mentioned in the VBScript portion of MS' official Windows Script Technologies sub-site, or MS's official Visual Basic for Applications home page, or the independent OfficeVBA.com web site. There are also various discussion archives and help sites such as:- MailBase UK's 'excel-vb-discuss' Mailing List Archive and 'office-vba-discuss' Mailing List Archive; ZDNet�s general Microsoft VBA Help sub-site and Office Forum; and, PCWorld's Spreadsheet Tips (e.g., the Sep 1997 issue includes an example copy/paste macro). In addition, there are various official MS VBA books available from BookPool and other sources, such as Microsoft Office 97/Visual Basic Programmer's Guide. All of these resources are pretty much Windows-oriented, but most of the info that's related to the language itself should also be relevant to Mac OS.

Regards,

--Paul

[This message has been edited by Paul Crawford (edited 06-25-2000).]
     
qnc  (op)
Mac Enthusiast
Join Date: May 2000
Location: London U.K.
Status: Offline
Reply With Quote
Jun 26, 2000, 12:47 PM
 
Well I would like three rows from an excel spread sheet copied into another genotpying program yes these are triggered by hotkeys and yes I would like them all to do it efficiently and with one key like a proper command structure moving down the coloums and copyting the information into the other application is this possible

P.S. this is my first attempt at this kind of Marco programing so consider this when giving me instructions

Thanks
qnctv.com
Take a look...
     
Paul Crawford
Dedicated MacNNer
Join Date: Nov 1999
Location: Georgetown, Demerara, Guyana
Status: Offline
Reply With Quote
Jun 29, 2000, 11:40 AM
 
Hi qnc,

I hope that you've already found your answer elsewhere [my VBA skills are a bit rusty, to say the least :-)]. However, since Excel is also "AppleScript-able" (& -recordable, I believe), it seems as though AppleScript might be the way to go here, rather than VBA. For example, if the target genotyping program is not VBA-aware but is AppleScript-able, then you could probably use the Script Editor's built-in recording facility to capture the entire process, all the way from Excel through to the target program (the resulting script may need a few tweaks for relative references, but hopefully not too many).

On the other hand, even if the target program is not AppleScript-able, you might still be able to use AppleScript to paste the copied data into it -- with the help of any one of several third-party freeware Scripting Additions ("OSAXen") that can simulate typing the standard 'Cmd-V' shortcut.

In any event, if you'd like to try using AppleScript instead, feel free to experiment with Script Editor:- hit that 'Record' button, switch to Excel, copy three rows, switch to the target program, paste the data, and then switch back to Script Editor to see what commands were recorded. AppleScript's syntax is much more "natural-language" than VBA's, and you could also try using the Script Editor's 'File | Open Dictionary...' menu-item to open up Excel and the target program to see the full list of AppleScript commands that they understand (including cell/range navigation commands for Excel).

Otherwise, if you'd like to continue using VBA, and you are unable to obtain more expert assistance through the various VBA resources that I mentioned above, please let us know, and either I or someone else will try our best to help you further.

Regards,

--Paul
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 07:13 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,