PDA

View Full Version : URGENT, Excel Macros!


PeiWen
11-05-2004, 06:11 PM
Hi people...it has been a long time since I last logged on..
Here's a problem...anyone can help me in Excel Macros?
I need to convert some Lotus-123 macros commands into Excel macros commands...

Sub Click(Source As Buttoncontrol)
Dim currdoc As document
Dim doc1 As String
Dim currpath As String
Dim mmyyyy As String
Set currdoc = CurrentDocument
currpath = currdoc.Path
mmyyyy = "012004"
doc1="84-110-0400."+mmyyyy+".SUMMARY"
doc2="84-110-0400."+mmyyyy+".LMADJ"
doc3="84-110-0400."+mmyyyy+".LMREC"
doc4="84-110-0400."+mmyyyy+".GLADJ"
doc5="84-110-0400."+mmyyyy+".GLREC"
doc6="84-110-0400."+mmyyyy+".CMATCH"
[DATA SUMMARY:A1..A100].Clear
[DATA LMADJ:A1..A1000].Clear
[DATA LMREC:A1..A1000].Clear
[DATA GLADJ:A1..A1000].Clear
[DATA GLREC:A1..A1000].Clear
[DATA CMATCH:A1..A1000].Clear
[DATA SUMMARY:A1].RangeCombineText doc1,currpath,$Text
[DATA LMADJ:A1].RangeCombineText doc2,currpath,$Text
[DATA LMREC:A1].RangeCombineText doc3,currpath,$Text
[DATA GLADJ:A1].RangeCombineText doc4,currpath,$Text
[DATA GLREC:A1].RangeCombineText doc5,currpath,$Text
[DATA CMATCH:A1].RangeCombineText doc6,currpath,$Text

End Sub



Thanks a lot...I need it urgently....

thesoothsayer
11-05-2004, 10:04 PM
Hi,

Haven't touched VBA for Excel for the longest time (>4 years) and I've never used lotus macros before so I'm not sure if this will be useful. It's just a general suggestion.

The macro seems to be doing this:

doc1="84-110-0400."+mmyyyy+".SUMMARY"
doc2="84-110-0400."+mmyyyy+".LMADJ"
doc3="84-110-0400."+mmyyyy+".LMREC"
doc4="84-110-0400."+mmyyyy+".GLADJ"
doc5="84-110-0400."+mmyyyy+".GLREC"
doc6="84-110-0400."+mmyyyy+".CMATCH"

Assigning names of the files that you wish to import the text from to the string variables here.

[quote]
[DATA SUMMARY:A1..A100].Clear
[DATA LMADJ:A1..A1000].Clear
[DATA LMREC:A1..A1000].Clear
[DATA GLADJ:A1..A1000].Clear
[DATA GLREC:A1..A1000].Clear
[DATA CMATCH:A1..A1000].Clear
[\quote]
Clearing off the the values from A1 to A1000 in a DATA object. Not sure what the data object is since it isn't declared here.

[quote]
[DATA SUMMARY:A1].RangeCombineText doc1,currpath,$Text
[DATA LMADJ:A1].RangeCombineText doc2,currpath,$Text
[DATA LMREC:A1].RangeCombineText doc3,currpath,$Text
[DATA GLADJ:A1].RangeCombineText doc4,currpath,$Text
[DATA GLREC:A1].RangeCombineText doc5,currpath,$Text
[DATA CMATCH:A1].RangeCombineText doc6,currpath,$Text
[\quote]
Then reimporting the text from the external files into the current object as text types.

Could you try to save the file in Excel format and record the macro from there? Since this sub seems to me to be a button that you click on everytime you want to refresh the data from the external sources.

Hopefully someone with more experience in VBA can come along and help you out. :)

PeiWen
12-05-2004, 08:42 AM
Thanks a lot thesoothsayer...your reply really helps a lot....

PeiWen
12-05-2004, 08:45 AM
seems to me to be a button that you click on everytime you want to refresh the data from the external sources.

You're right. It's actually a button and it will do the task that you've stated above.