Click here to Skip to main content
15,887,376 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: open file location thru windows explorer Pin
Mendel Margallo Adona6-Oct-15 0:34
Mendel Margallo Adona6-Oct-15 0:34 
AnswerRe: open file location thru windows explorer Pin
Mendel Margallo Adona6-Oct-15 4:02
Mendel Margallo Adona6-Oct-15 4:02 
QuestionVb6 resource file and ms access database Pin
Otekpo Emmanuel3-Oct-15 2:29
Otekpo Emmanuel3-Oct-15 2:29 
AnswerRe: Vb6 resource file and ms access database Pin
Dave Kreskowiak3-Oct-15 4:58
mveDave Kreskowiak3-Oct-15 4:58 
GeneralRe: Vb6 resource file and ms access database Pin
Otekpo Emmanuel5-Oct-15 6:35
Otekpo Emmanuel5-Oct-15 6:35 
QuestionExcel Macros - copy & paste from one workbook to another Pin
MikeK3229-Sep-15 6:17
MikeK3229-Sep-15 6:17 
AnswerRe: Excel Macros - copy & paste from one workbook to another Pin
CHill6030-Sep-15 0:21
mveCHill6030-Sep-15 0:21 
GeneralRe: Excel Macros - copy & paste from one workbook to another Pin
MikeK3230-Sep-15 9:14
MikeK3230-Sep-15 9:14 
That was not it. Thanks for the suggestion. I am getting a "Runtime error 13" Type Mismatch on the line Set xlWorkSheet1 = ActiveWorksheet

There are 2 possible worksheets that could be the active one so I am trying to check which one is currently active.

Function GetThisWB() As String
GetThisWB = ThisWorkbook.Path & "\" & ThisWorkbook.Name
End Function
Public Sub export_data()

'
'

'Delcare variables
Dim xlApp As New Excel.Application
Dim xlWorkBook1 As Excel.Workbooks
Dim xlWorkBook2 As Excel.Workbooks
Dim xlWorkSheet1 As Excel.Worksheets
Dim xlWorkSheet2 As Excel.Worksheets
Dim xlworksheet3 As Excel.Worksheets
Dim xlSourceRange As Excel.Range
Dim xlDestRange As Excel.Range

'
'Set source workbook as active
'

'Display Excel
xlApp.Visible = True

''Set the source active worksheet
'

If Worksheets("GDI Connector").Activate = True Then
Set xlWorkSheet1 = ActiveSheet
ElseIf Worksheets("GDI Core").Activate = True Then
Set xlWorkSheet2 = ActiveSheet
End If


'Set the source range
xlSourceRange = xlWorkSheets.Range("F1:F120")
xlSourceRange.Copy


'Open workbook 2 and set the destination worksheet as active
Workbooks.Open ("C:\Users\Michael\Documents\Greystone\GDI Line\Denso GDI (Hitachi Templates 7.9.2015)")

xlworksheet3("Export").Select

'Set the destination range
xlDestRange = xlWorkSheets.Range("B34")

'Copy and paste the range
xlDestRange.PasteSpecial

'
Application.Goto Reference:="export_data"
ActiveWorkbook.Save
End Sub
GeneralRe: Excel Macros - copy & paste from one workbook to another Pin
CHill6030-Sep-15 10:27
mveCHill6030-Sep-15 10:27 
QuestionPenny for Pay question Pin
BrianStrong28-Sep-15 14:10
BrianStrong28-Sep-15 14:10 
AnswerRe: Penny for Pay question Pin
Richard MacCutchan28-Sep-15 21:43
mveRichard MacCutchan28-Sep-15 21:43 
AnswerRe: Penny for Pay question Pin
Chris Quinn29-Sep-15 0:53
Chris Quinn29-Sep-15 0:53 
AnswerRe: Penny for Pay question Pin
Matt T Heffron29-Sep-15 10:35
professionalMatt T Heffron29-Sep-15 10:35 
QuestionPlease explain this. Pin
Member 1201796828-Sep-15 11:40
Member 1201796828-Sep-15 11:40 
AnswerRe: Please explain this. Pin
Dave Kreskowiak28-Sep-15 12:22
mveDave Kreskowiak28-Sep-15 12:22 
QuestionImport data from photon Pin
Member 1051522527-Sep-15 19:10
professionalMember 1051522527-Sep-15 19:10 
Questionconverting a embedded xml file resource to a xml object Pin
jkirkerx23-Sep-15 9:51
professionaljkirkerx23-Sep-15 9:51 
Answer[Cancel That] Pin
jkirkerx23-Sep-15 11:36
professionaljkirkerx23-Sep-15 11:36 
QuestionEmbedded Windows Media Player stream playing query Pin
Magrat23-Sep-15 8:26
Magrat23-Sep-15 8:26 
QuestionHOw I can find a sent mail with vba? Pin
Member 1199849020-Sep-15 13:21
Member 1199849020-Sep-15 13:21 
AnswerRe: HOw I can find a sent mail with vba? Pin
Dave Kreskowiak25-Sep-15 14:56
mveDave Kreskowiak25-Sep-15 14:56 
QuestionCan radio buttons have more than 1 function? Pin
Member 1199784020-Sep-15 3:55
Member 1199784020-Sep-15 3:55 
SuggestionRe: Can radio buttons have more than 1 function? Pin
Maciej Los20-Sep-15 5:32
mveMaciej Los20-Sep-15 5:32 
GeneralRe: Can radio buttons have more than 1 function? Pin
Member 1199784020-Sep-15 5:46
Member 1199784020-Sep-15 5:46 
GeneralRe: Can radio buttons have more than 1 function? Pin
Maciej Los20-Sep-15 5:59
mveMaciej Los20-Sep-15 5:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.