Need help with VBA

sinkoman

Party Escort Bot
Joined
Dec 2, 2004
Messages
7,457
Reaction score
21
K, so I need to write a set of procedures/methods/functions (whatever the **** they're called in VBA) that create a set of excel documents based on a document template, and then populate the documents with data leeched off of a base document.

Problem is though that I don't know ANYTHING about VBA. My experience resides with Java and PHP, not Basic...

So i'm having a bit of a time trying to figure out how the **** "Functions" work in VBA. Apparently they aren't anything like "methods" in java, since I can't seem to call them on a whim within my code.

This is basically what I want to be able to do:

Code:
public void thisFunc(Object Fred){
     //**** around with the data in Fred
     Return Fred
}

bla bla bla main method header whatever...
declare phil

     Phil = thisFunc(Phil)

But I don't know how the hell to do that in VBA. I can make a function, set the return type and everything, but when I actually you know, try to "return" data (Return returnVar), excel throws me an "Expected end of expression" syntax error. WTF???

Other problem is that I don't know how to work with the "workbook" object. All I want to do is declare an object called "newWkBook" as an excel sheet class (WHAT THE **** IS THE EXCEL SHEET CLASS? I can set the bastard as "workbook" and "workbookS", WHICH IS IT???)

SO, this is what i'm TRYING to do

Code:
Dim newWkBook as workbook (or workbook[B]s[/B], WHICH IS IT???)
Dim nameVar as String

Set newWkBook = workbooks.add (templateSrc)
Set nameVar = "penis"

newWkBook.SaveAs(nameVar)

But VBA is throwing a hissy fit at me. How the **** do I access the object once i've created it? I can't seem to access it via the "newWkBook" object I made, because when I enter "newWkBook." i'm presented with absolutely NO methods...

Jesus, and I thought VBA was supposed to be SIMPLE!
 
wat

Okay, no spammo. I really find programming interesting because it seems such an arcane system, but is not, all things considered, much different from any other language schema. I wish I could program.

Okay, actually I don't. I'd never be patient enough D:
 
Back
Top