Snowflake-Labs / Excelerator

This is an Excel Addin for Windows that reads and writes data to Snowflake
Apache License 2.0
80 stars 22 forks source link

How do you call the functions in VBA to automate the upload process? #46

Closed henryhodgson closed 5 months ago

henryhodgson commented 5 months ago

Hi,

I have a project with seven worksheets, each of which has a single table on it. I want to create a button for each worksheet which autofills the Upload Data box: Schema, Table and Table Key Columns. I cannot find the VBA code to do this.

Please could you help with this?

Henry

henryhodgson commented 5 months ago

Sub AutofillUploadDataForm_Sheet1() With UploadDataForm .cbDatabases.Text = "DATABASE" .cbSchemas.value = "SCHEMA" .cbTables.Text = "TABLE" .tbMergeKeys.Text = "A,B,C" End With End Sub

Sub MasterAutofillUploadDataForm() Select Case ActiveSheet.name Case "Sheet1" AutofillUploadDataForm_Sheet1 Case Else MsgBox "Unknown sheet: " & ActiveSheet.name End Select

End Sub

Sub ShowUploadDataForm() UploadDataForm.Show End Sub

and calling Call MasterAutofillUploadDataForm in Public Sub UserForm_Initialize() has got this working